SlideShare a Scribd company logo
Automating MongoDB
CloudFormation and Chef
Bryan Kroger

•  Sr. Automation Engineer at HTC
•  Previously worked at HP on the HPCloud
• 
• 

project.
Big fan of all things cloud and DevOps.
Startups are my passion.

“If it can’t be automated, it shouldn’t exist.”
README
This session is focused on using chef and
CloudFormation to automate and manage a
large-scale MongoDB shard.
Scope
Automating MongoDB resource creation.
Shards
Config servers
Not using repl sets

• 
• 
• 
Resilience?
1.  the ability of a substance or object to spring back into
shape; elasticity.
2.  the capacity to recover quickly from difficulties;
toughness.
Planning around the idea of bouncing back from failure is
more productive than trying to prevent failure from
happening. Failure is inevitable, so plan for it!
Use case
“CloudRim” is a game I created
using CloudFormation, based the
movie “Pacific Rim”
The Kaijus emerge from the rift and
start destroying cities. The Jaegers
are dispatched to fight the
monsters.
CloudFormation

•  Built on the Simple Workflow platform.
•  Amazon does most of the work.
•  Auto scaling rocks!
•  Forces good automation practices.
•  Resilient design.
Lazy as a Service ( LaaS )
Chef
Is a tool.
CloudFormation Templates
Big things from small bits of JSON…
Auto Scale Groups
EBS Volumes
EBS Attachments

• 
• 
• 
Chef bits
/etc/chef/dna.json

•  mdadm raid creation
•  format array
•  mount formatted array
•  CloudFormation callback ( “I’m done!” )
Building with Jenkins
Jobs are built with chef.
Build pipelines help maintain state.
MongoDB, Cloudformation and Chef
Many blocks...
Pros
●  Load is distributed over many
network attached disks.
●  Potentially spreading this load
over more, different spindles.
●  Networking is cheap.
●  Potentially higher I/O
performance over all.

Cons
●  More complicated layout ( which
is mostly mitigated by chef and
CF, but still a valid concern )
●  Software RAID overhead.
●  Introducing more potential for
failure.
Single disk
Pros

Cons

●  Manual operations are easier.
●  Less complication.
●  Potentially using many spindles
on the backend.
●  No RAID overhead.

●  Potential bottleneck if the entire
block is allocated on one spindle.
What is the goal?
Fast I/O, of course!
Customers are fickle, latency costs money.
But so does downtime.
Fast I/O = many EBS volumes.
Replication sets give us redundancy.
But chef and jenkins gives us resilience.
Start with chef building jenkins
Everything starts with our ability to build the
thing that builds the things. This is where
chef’s LWRP’s come in:
mongodb_build_pipeline “us-east-1b” do
num_shards 10
num_config_servers 3
end
CI / CD
Jenkins is configured to run the build pipelines
at given intervals.
CloudFormation does all of the work to
manage rollbacks if something goes wrong.
This gives us CI / CD at the database level.
CI / CD at the db level?
Are you nuts? No, my mother had me tested.
This allows us to dynamically scale our
shards, and ensure that if someone does
something stupid we can recover.
Reslience!!
CloudFormation handoff to chef
CloudFormation allows us to send a little
snippet of bash to our new instances. In that
bash we call the following:
chef-client -j /etc/chef/dna.json
This is where the magic happens.
/etc/chef/dna.json
{
"run_list": [ "role[mongo-core]", "role[ebs-raid]" ],
"raid_groups": [{ "type": 0, "mount_range_start": "b", "name": "mongo_data",
"mount_point": "/mnt/data", "num_vols": 20 }]
}

This is how the raid groups are defined and
eventually built automatically when the
instance is spun up.
The chef AWS cookbook
Why not use it?
Because CloudFormation does a better job of
creating and attaching the volumes.
Keeping the resource definitions in the same
place is a good thing.
Chef is a tool!
Conclusion
Chef -> Jenkins -> AWS CloudFormation
Resources ( config servers and shards ) are
configured and coordinated with chef.
Route53 allows us to name everything.
VPC’s are used to isolate everything.
Git is used to track everything.

More Related Content

PPTX
The Chef Prince of Azure - ChefConf 2015
PDF
GDG Cloud Southlake #8 Steve Cravens: Infrastructure as-Code (IaC) in 2022: ...
PDF
Kubernetes and Cloud Native Update Q4 2018
PDF
Architecting for Continuous Delivery
PDF
Resilient microservices with Kubernetes - Mete Atamel
PDF
TDC2017 | São Paulo - Trilha Cloud Computing How we figured out we had a SRE ...
PDF
DCEU 18: Docker Container Networking
PDF
Advanced Spark and TensorFlow Meetup - Dec 12 2017 - Dong Meng, MapR + Kubern...
The Chef Prince of Azure - ChefConf 2015
GDG Cloud Southlake #8 Steve Cravens: Infrastructure as-Code (IaC) in 2022: ...
Kubernetes and Cloud Native Update Q4 2018
Architecting for Continuous Delivery
Resilient microservices with Kubernetes - Mete Atamel
TDC2017 | São Paulo - Trilha Cloud Computing How we figured out we had a SRE ...
DCEU 18: Docker Container Networking
Advanced Spark and TensorFlow Meetup - Dec 12 2017 - Dong Meng, MapR + Kubern...

What's hot (20)

PPTX
High Performance Cloud-Native Microservices IndyCloudConf 2020
PDF
TDC2017 | São Paulo - Trilha Cloud Computing How we figured out we had a SRE ...
PPTX
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
PDF
You Might Just be a Functional Programmer Now
PPTX
Simple tweaks to get the most out of your JVM
PDF
Big data and Kubernetes
PDF
Fabio Ferrari | particles.io | Presentation
PDF
Shakr - Container CI/CD with Google Cloud Platform
PDF
DCEU 18: Edge Computing with Docker Enterprise
PDF
DCEU 18: Developing with Docker Containers
PPT
Introduction to KubeDirector - SF Kubernetes Meetup
PDF
Guide To Continuous Deployment Containerization With Docker Complete Deck
PDF
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
PPTX
Application Modernization with PKS / Kubernetes
PDF
Pivotal Greenplum in Action on AWS, Azure, and GCP - Greenplum Summit 2018
PPTX
Kubernetes on EGO : Bringing enterprise resource management and scheduling to...
PDF
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
PPTX
DevOps for Big Data - Data 360 2014 Conference
PDF
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
PPTX
Episode 2: Deploying Kubernetes at Scale
High Performance Cloud-Native Microservices IndyCloudConf 2020
TDC2017 | São Paulo - Trilha Cloud Computing How we figured out we had a SRE ...
Deploying Cloud Native Red Team Infrastructure with Kubernetes, Istio and Envoy
You Might Just be a Functional Programmer Now
Simple tweaks to get the most out of your JVM
Big data and Kubernetes
Fabio Ferrari | particles.io | Presentation
Shakr - Container CI/CD with Google Cloud Platform
DCEU 18: Edge Computing with Docker Enterprise
DCEU 18: Developing with Docker Containers
Introduction to KubeDirector - SF Kubernetes Meetup
Guide To Continuous Deployment Containerization With Docker Complete Deck
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Application Modernization with PKS / Kubernetes
Pivotal Greenplum in Action on AWS, Azure, and GCP - Greenplum Summit 2018
Kubernetes on EGO : Bringing enterprise resource management and scheduling to...
Kubo (Cloud Foundry Container Platform): Your Gateway Drug to Cloud-native
DevOps for Big Data - Data 360 2014 Conference
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
Episode 2: Deploying Kubernetes at Scale
Ad

Similar to MongoDB, Cloudformation and Chef (20)

PDF
EC2 AMI Factory with Chef, Berkshelf, and Packer
PDF
Chef Provisioning a Chef Server Cluster - ChefConf 2015
PDF
Introduction to Chef
PDF
What is Chef and how we use it at tripsta
PDF
Automating your infrastructure with Chef
PDF
PDF
Planning Application Resilience - Developer Week 2015
PDF
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud Infrastructure
PPTX
Kickstarter - Chef Opswork
PDF
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
PDF
2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon Drange
PDF
OSDC 2013 | Introduction into Chef by Andy Hawkins
PDF
Atmosphere 2014: Really large scale systems configuration - Phil Dibowitz
PDF
DevOps 2015 - Dancing with Chef
PPT
Packing It In: Images, Containers and Config Management
PDF
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
KEY
Chef 0.8, Knife and Amazon EC2
PDF
PDF
IaaS with Chef
PDF
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
EC2 AMI Factory with Chef, Berkshelf, and Packer
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Introduction to Chef
What is Chef and how we use it at tripsta
Automating your infrastructure with Chef
Planning Application Resilience - Developer Week 2015
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud Infrastructure
Kickstarter - Chef Opswork
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon Drange
OSDC 2013 | Introduction into Chef by Andy Hawkins
Atmosphere 2014: Really large scale systems configuration - Phil Dibowitz
DevOps 2015 - Dancing with Chef
Packing It In: Images, Containers and Config Management
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef 0.8, Knife and Amazon EC2
IaaS with Chef
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Ad

More from MongoDB (20)

PDF
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
PDF
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
PDF
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
PDF
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
PDF
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
PDF
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
PDF
MongoDB SoCal 2020: MongoDB Atlas Jump Start
PDF
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
PDF
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
PDF
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
PDF
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
PDF
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
PDF
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
PDF
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
PDF
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
PDF
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
PDF
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
PDF
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...

Recently uploaded (20)

PPTX
ICG2025_ICG 6th steering committee 30-8-24.pptx
PPTX
New Microsoft PowerPoint Presentation - Copy.pptx
PDF
Unit 1 Cost Accounting - Cost sheet
PDF
Training And Development of Employee .pdf
PDF
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
PDF
kom-180-proposal-for-a-directive-amending-directive-2014-45-eu-and-directive-...
PDF
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
PPTX
The Marketing Journey - Tracey Phillips - Marketing Matters 7-2025.pptx
PPTX
Belch_12e_PPT_Ch18_Accessible_university.pptx
PDF
COST SHEET- Tender and Quotation unit 2.pdf
PDF
How to Get Funding for Your Trucking Business
PPT
340036916-American-Literature-Literary-Period-Overview.ppt
PDF
Business model innovation report 2022.pdf
PDF
Laughter Yoga Basic Learning Workshop Manual
PDF
pdfcoffee.com-opt-b1plus-sb-answers.pdfvi
PDF
Elevate Cleaning Efficiency Using Tallfly Hair Remover Roller Factory Expertise
PPT
Chapter four Project-Preparation material
PDF
Stem Cell Market Report | Trends, Growth & Forecast 2025-2034
DOCX
unit 1 COST ACCOUNTING AND COST SHEET
PDF
Chapter 5_Foreign Exchange Market in .pdf
ICG2025_ICG 6th steering committee 30-8-24.pptx
New Microsoft PowerPoint Presentation - Copy.pptx
Unit 1 Cost Accounting - Cost sheet
Training And Development of Employee .pdf
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
kom-180-proposal-for-a-directive-amending-directive-2014-45-eu-and-directive-...
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
The Marketing Journey - Tracey Phillips - Marketing Matters 7-2025.pptx
Belch_12e_PPT_Ch18_Accessible_university.pptx
COST SHEET- Tender and Quotation unit 2.pdf
How to Get Funding for Your Trucking Business
340036916-American-Literature-Literary-Period-Overview.ppt
Business model innovation report 2022.pdf
Laughter Yoga Basic Learning Workshop Manual
pdfcoffee.com-opt-b1plus-sb-answers.pdfvi
Elevate Cleaning Efficiency Using Tallfly Hair Remover Roller Factory Expertise
Chapter four Project-Preparation material
Stem Cell Market Report | Trends, Growth & Forecast 2025-2034
unit 1 COST ACCOUNTING AND COST SHEET
Chapter 5_Foreign Exchange Market in .pdf

MongoDB, Cloudformation and Chef

  • 2. Bryan Kroger •  Sr. Automation Engineer at HTC •  Previously worked at HP on the HPCloud •  •  project. Big fan of all things cloud and DevOps. Startups are my passion. “If it can’t be automated, it shouldn’t exist.”
  • 3. README This session is focused on using chef and CloudFormation to automate and manage a large-scale MongoDB shard.
  • 4. Scope Automating MongoDB resource creation. Shards Config servers Not using repl sets •  •  • 
  • 5. Resilience? 1.  the ability of a substance or object to spring back into shape; elasticity. 2.  the capacity to recover quickly from difficulties; toughness. Planning around the idea of bouncing back from failure is more productive than trying to prevent failure from happening. Failure is inevitable, so plan for it!
  • 6. Use case “CloudRim” is a game I created using CloudFormation, based the movie “Pacific Rim” The Kaijus emerge from the rift and start destroying cities. The Jaegers are dispatched to fight the monsters.
  • 7. CloudFormation •  Built on the Simple Workflow platform. •  Amazon does most of the work. •  Auto scaling rocks! •  Forces good automation practices. •  Resilient design. Lazy as a Service ( LaaS )
  • 9. CloudFormation Templates Big things from small bits of JSON… Auto Scale Groups EBS Volumes EBS Attachments •  •  • 
  • 10. Chef bits /etc/chef/dna.json •  mdadm raid creation •  format array •  mount formatted array •  CloudFormation callback ( “I’m done!” )
  • 11. Building with Jenkins Jobs are built with chef. Build pipelines help maintain state.
  • 13. Many blocks... Pros ●  Load is distributed over many network attached disks. ●  Potentially spreading this load over more, different spindles. ●  Networking is cheap. ●  Potentially higher I/O performance over all. Cons ●  More complicated layout ( which is mostly mitigated by chef and CF, but still a valid concern ) ●  Software RAID overhead. ●  Introducing more potential for failure.
  • 14. Single disk Pros Cons ●  Manual operations are easier. ●  Less complication. ●  Potentially using many spindles on the backend. ●  No RAID overhead. ●  Potential bottleneck if the entire block is allocated on one spindle.
  • 15. What is the goal? Fast I/O, of course! Customers are fickle, latency costs money. But so does downtime. Fast I/O = many EBS volumes. Replication sets give us redundancy. But chef and jenkins gives us resilience.
  • 16. Start with chef building jenkins Everything starts with our ability to build the thing that builds the things. This is where chef’s LWRP’s come in: mongodb_build_pipeline “us-east-1b” do num_shards 10 num_config_servers 3 end
  • 17. CI / CD Jenkins is configured to run the build pipelines at given intervals. CloudFormation does all of the work to manage rollbacks if something goes wrong. This gives us CI / CD at the database level.
  • 18. CI / CD at the db level? Are you nuts? No, my mother had me tested. This allows us to dynamically scale our shards, and ensure that if someone does something stupid we can recover. Reslience!!
  • 19. CloudFormation handoff to chef CloudFormation allows us to send a little snippet of bash to our new instances. In that bash we call the following: chef-client -j /etc/chef/dna.json This is where the magic happens.
  • 20. /etc/chef/dna.json { "run_list": [ "role[mongo-core]", "role[ebs-raid]" ], "raid_groups": [{ "type": 0, "mount_range_start": "b", "name": "mongo_data", "mount_point": "/mnt/data", "num_vols": 20 }] } This is how the raid groups are defined and eventually built automatically when the instance is spun up.
  • 21. The chef AWS cookbook Why not use it? Because CloudFormation does a better job of creating and attaching the volumes. Keeping the resource definitions in the same place is a good thing. Chef is a tool!
  • 22. Conclusion Chef -> Jenkins -> AWS CloudFormation Resources ( config servers and shards ) are configured and coordinated with chef. Route53 allows us to name everything. VPC’s are used to isolate everything. Git is used to track everything.