SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Downloaden Sie, um offline zu lesen
Keeping AWS in check with Puppet 
or 
“Managing cloud networking with Puppet with a healthy dose of 
trolling yourself on the side” 
Matt Carroll
HELLO.
What’s all this about then? 
● We use AWS extensively, especially EC2 
● We needed a way to organise our AWS networking (VPCs) 
● It needs to be: 
○ Centrally managed 
○ Reproducible 
○ Declarative (idempotent) 
○ Ideally not another solution on top of a stack of solutions
Spoiler 
We (Tom) decided to use Puppet 
We wrote a set of types and providers to use 
with the AWS API
What I’m going to cover 
YOU ARE HERE 
1. Intro 
2. AWS networking basics 
3. Why we chose Puppet 
4. How it actually works 
5. Some of the “interesting” things we learned 
6. Summary 
7. Questions
What I hope you’ll get from this 
● A sense of Puppet as an extensible framework that can 
manage dependencies in external APIs 
● Nodes are just units of computing capacity - an operation 
does not have to be a subset of a node 
● Some insight into the types and providers system 
● Some of the strange things we learned along the way 
… and as always...
To serve as a lesson to others.
SOME AWS BASICS.
Some 
of this 
isn’t 
exactly 
retina 
resolution
The (simplified) Hierarchy 
Account 
Region 
VPC 
Routetable 
Subnet
The (needlessly complicated simplified) 
Hierarchy 
Account: 
• Region 
• dopt: DHCP Options 
• vpc: Virtual Private Cloud 
• igw: Internet Gateway 
• cgw: Customer Gateway 
• vgw: Virtual Gateway 
• vpn: VPN 
• routetable 
• subnet
How do we make all these objects? 
Just make them in the console!
How do we make all these objects? 
IF YOU HATE YOURSELF 
Just make them in the console!
How do we actually make all of these objects? 
• AWS::SDK! 
• We’ll have to ensure that the resources get created (and 
purged)... 
• Idempotently… 
• With all their dependencies… 
• Remind you of something?
USE PUPPET!
Create Puppet types for VPC objects! 
● Resources for each of the objects 
○ All API calls made on this level 
○ Will contain all code for reading and creating individual 
resources 
○ No dependencies other than autorequires in the types - 
those in the hierarchy earlier 
● Business logic in manifests 
○ For your site-specific dependencies and network structure 
○ e.g. we have a separate VPC for each environment 
● Data in hiera
(Actually though) Why Puppet? 
• With the ability to query and create and modify objects 
through the API we can state them declaratively 
• We can thus create resources which can be included or 
purged idempotently 
• Rather than specify order, we can state dependencies 
and allow Puppet to figure order out
Why Puppet? 
Using this model you can even collect dependencies and 
resources: 
• Make all resources of a type with a parameter evaluate after 
another 
• Control purge and no-op of all aws resources
Why Puppet? 
Admittedly it seems a little asymmetrical: 
• Puppet runs on nodes which creates 
resources in AWS 
• AWS networking is not a subset of a node 
• Nodes just act as executors for creating AWS 
resource 
But actually this plays to our advantage (more on 
this later)
HOW IT WORKS.
Puppet Types 
• The bit that you specify in 
the manifest 
• Really just a DDL for the 
resource’s metadata 
• The “front end” for the 
pluggable “back end” (the 
provider) 
• Interface to specify all 
properties and parameters
Puppet Providers 
• The business end 
• This is where the API 
code lives 
• Quite a lot longer 
• Handles all application 
and querying of the 
resource including 
prefetch
What’s a “prefetch”? 
• Some resources are 
expensive to read, so 
you read them all once 
when you first come 
across one 
• This is done before the 
catalog is completely 
compiled
Manifest examples
Associated Infrastructure 
• How do you handle multiple accounts? 
• Dedicated AWS admin box within each 
account to apply the resources on 
• IAM roles to handle credentials 
• Logging resource changes separately 
• Why not do it in the code...?
LESSONS LEARNED. 
(the hard way)
Don’t 
do 
what 
Donny 
Don’t 
does
Why not put credentials in the code?
Why not put credentials in the code? 
• We (I) tried to make an 
aws_credentials type 
• This requires access to the 
catalog in the prefetch phase so 
other resources can query it 
• You ALSO need to guarantee 
type evaluation order and 
access to credentials in the 
catalog so that you can use 
prefetch
Why not put credentials in the code? 
• The instances method suddenly 
requires an argument 
• In fact, so does anything that 
isn’t an instance method 
• Actually ended up copying and 
pasting the resources resource 
to aws_resources and adding in 
a “credentials” parameter
On second thoughts...
Prefetch isn’t… Exceptional 
• https://tickets.puppetlabs.com/browse/PUP-3656 
• This means that if anything goes awry in prefetch, puppet will 
swallow it 
• In our case, we hit the API limit occasionally, meaning we got 
duplicate resources
So we did a bad thing...
Asynchronous APIs tell lies 
• When you create an object you get 
a 200 OK 
• This doesn’t mean “I’ve done it”, 
this means “I’ll do it” 
• In a dependency chain, this can 
mean that a resource is about to be 
created, but when it’s checked by 
another resource it’s not there yet 
• In the Puppet paradigm it’s best 
just to run until convergence.
SO IN SUMMARY...
What I learned (the hard way) 
• The “resources” resource 
• Is hard to understand unless 
you read the code (type only) 
because Googling it is 
impossible. 
• Could do with being able to 
apply other arbitrary 
properties and parameters?* 
*this may be an awful idea
What I learned (the hard way) 
• Instances vs. class methods paradigm gets very confusing 
because it is tied to applying catalogue vs. prefetch 
• Prefetch is generally pretty confusing when you add in 
dependencies TO the prefetch
What really cool things I learned 
• You can reproduce AWS networking (and other objects 
thanks to other contributors!) 
• A really cool insight into the types and providers system and 
how it could grow in the future 
• Learning to treat servers not like pets OR cattle but as a 
medium by which you do useful stuff 
… and you could do this with a whole bunch of 
APIs
THANKS FOR LISTENING! 
github.com/bobtfish/puppet-aws_api 
Matt Carroll 
SRE at Yelp 
@oholiab 
mattc@yelp.com 
yelp.com/careers (we’re hiring)

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Kürzlich hochgeladen (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Empfohlen

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Empfohlen (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Keeping AWS in check with Puppet (Puppetcamp London 2014-11-17)

  • 1. Keeping AWS in check with Puppet or “Managing cloud networking with Puppet with a healthy dose of trolling yourself on the side” Matt Carroll
  • 3.
  • 4. What’s all this about then? ● We use AWS extensively, especially EC2 ● We needed a way to organise our AWS networking (VPCs) ● It needs to be: ○ Centrally managed ○ Reproducible ○ Declarative (idempotent) ○ Ideally not another solution on top of a stack of solutions
  • 5. Spoiler We (Tom) decided to use Puppet We wrote a set of types and providers to use with the AWS API
  • 6. What I’m going to cover YOU ARE HERE 1. Intro 2. AWS networking basics 3. Why we chose Puppet 4. How it actually works 5. Some of the “interesting” things we learned 6. Summary 7. Questions
  • 7. What I hope you’ll get from this ● A sense of Puppet as an extensible framework that can manage dependencies in external APIs ● Nodes are just units of computing capacity - an operation does not have to be a subset of a node ● Some insight into the types and providers system ● Some of the strange things we learned along the way … and as always...
  • 8. To serve as a lesson to others.
  • 10. Some of this isn’t exactly retina resolution
  • 11. The (simplified) Hierarchy Account Region VPC Routetable Subnet
  • 12. The (needlessly complicated simplified) Hierarchy Account: • Region • dopt: DHCP Options • vpc: Virtual Private Cloud • igw: Internet Gateway • cgw: Customer Gateway • vgw: Virtual Gateway • vpn: VPN • routetable • subnet
  • 13. How do we make all these objects? Just make them in the console!
  • 14. How do we make all these objects? IF YOU HATE YOURSELF Just make them in the console!
  • 15. How do we actually make all of these objects? • AWS::SDK! • We’ll have to ensure that the resources get created (and purged)... • Idempotently… • With all their dependencies… • Remind you of something?
  • 17.
  • 18. Create Puppet types for VPC objects! ● Resources for each of the objects ○ All API calls made on this level ○ Will contain all code for reading and creating individual resources ○ No dependencies other than autorequires in the types - those in the hierarchy earlier ● Business logic in manifests ○ For your site-specific dependencies and network structure ○ e.g. we have a separate VPC for each environment ● Data in hiera
  • 19. (Actually though) Why Puppet? • With the ability to query and create and modify objects through the API we can state them declaratively • We can thus create resources which can be included or purged idempotently • Rather than specify order, we can state dependencies and allow Puppet to figure order out
  • 20. Why Puppet? Using this model you can even collect dependencies and resources: • Make all resources of a type with a parameter evaluate after another • Control purge and no-op of all aws resources
  • 21. Why Puppet? Admittedly it seems a little asymmetrical: • Puppet runs on nodes which creates resources in AWS • AWS networking is not a subset of a node • Nodes just act as executors for creating AWS resource But actually this plays to our advantage (more on this later)
  • 23. Puppet Types • The bit that you specify in the manifest • Really just a DDL for the resource’s metadata • The “front end” for the pluggable “back end” (the provider) • Interface to specify all properties and parameters
  • 24. Puppet Providers • The business end • This is where the API code lives • Quite a lot longer • Handles all application and querying of the resource including prefetch
  • 25. What’s a “prefetch”? • Some resources are expensive to read, so you read them all once when you first come across one • This is done before the catalog is completely compiled
  • 27. Associated Infrastructure • How do you handle multiple accounts? • Dedicated AWS admin box within each account to apply the resources on • IAM roles to handle credentials • Logging resource changes separately • Why not do it in the code...?
  • 29. Don’t do what Donny Don’t does
  • 30. Why not put credentials in the code?
  • 31. Why not put credentials in the code? • We (I) tried to make an aws_credentials type • This requires access to the catalog in the prefetch phase so other resources can query it • You ALSO need to guarantee type evaluation order and access to credentials in the catalog so that you can use prefetch
  • 32. Why not put credentials in the code? • The instances method suddenly requires an argument • In fact, so does anything that isn’t an instance method • Actually ended up copying and pasting the resources resource to aws_resources and adding in a “credentials” parameter
  • 34. Prefetch isn’t… Exceptional • https://tickets.puppetlabs.com/browse/PUP-3656 • This means that if anything goes awry in prefetch, puppet will swallow it • In our case, we hit the API limit occasionally, meaning we got duplicate resources
  • 35. So we did a bad thing...
  • 36. Asynchronous APIs tell lies • When you create an object you get a 200 OK • This doesn’t mean “I’ve done it”, this means “I’ll do it” • In a dependency chain, this can mean that a resource is about to be created, but when it’s checked by another resource it’s not there yet • In the Puppet paradigm it’s best just to run until convergence.
  • 38. What I learned (the hard way) • The “resources” resource • Is hard to understand unless you read the code (type only) because Googling it is impossible. • Could do with being able to apply other arbitrary properties and parameters?* *this may be an awful idea
  • 39. What I learned (the hard way) • Instances vs. class methods paradigm gets very confusing because it is tied to applying catalogue vs. prefetch • Prefetch is generally pretty confusing when you add in dependencies TO the prefetch
  • 40. What really cool things I learned • You can reproduce AWS networking (and other objects thanks to other contributors!) • A really cool insight into the types and providers system and how it could grow in the future • Learning to treat servers not like pets OR cattle but as a medium by which you do useful stuff … and you could do this with a whole bunch of APIs
  • 41. THANKS FOR LISTENING! github.com/bobtfish/puppet-aws_api Matt Carroll SRE at Yelp @oholiab mattc@yelp.com yelp.com/careers (we’re hiring)