Real World AWS Deployment With Boto, Fabric, and Cloud Formation

22
Real World AWS Deployment Deploying MongoDB with Fabric, Boto, and Cloud Formation {[email protected] }, @nixonhughes

description

A real world use case of spinning up EC2 instances using a Python based frameworks (Fabric and Boto) and Cloud Formation. Source code is available on https://github.com/dixonwh/aws-provisioning

Transcript of Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Page 1: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Real World AWS Deployment

Deploying MongoDB with Fabric, Boto, and Cloud Formation

{[email protected]}, @nixonhughes

Page 2: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Who Am I ?

Software Engineer @ PokitdokTasked with scaling out infrastructureDeveloped custom provisioning process for AWS (Boto, Fabric, Cloud Formation)

Page 3: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

What we’ll cover . . .

Amazon Web Services Overview (EC2, ESB, Regions, etc)

REALISTIC provisioningBuilding a provisioning solution with Boto, Fabric, and Cloud Formation to deploy a MongoDB Replica Set

Page 4: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

AWS Overview

Cloud Computing and Infrastructure as a Service (Iaas)

AWS Regions and Availability ZonesAmazon Machine Images (AMI)

Page 5: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

AWS Overview (continued)

Core ServicesElastic Compute (EC2)Elastic Block Storage (EBS)Elastic IP

TaggingSecurity GroupsAccessing Instances

Page 6: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Realistic Provisioning

Base process off of configuration standards: directory layouts, users, etc.

Processes are repeatable (scripted) but may not be 100% automated

Iterate to improve automation %

Page 7: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

the alternative . . .

Page 8: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Boto – Python Interface for AWS

Hosted on githubActivate developer community on Google Groups

Supports additional services such as OpenStack, Eucalyptus, and Google Storage

Page 9: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Boto Examples

Stop all instances in us-west-2

Get all running Mongo Instances

Page 10: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Fabric – Python SSH Library

Hosted on githubEncapsulates common ssh/scp operations

Executable tasks are plain ‘ol Python functions decorated with @task

Page 11: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Fabric Examples

Start services

Command line task execution

Page 12: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

AWS Cloud Formation

Declarative provisioning and deployment tool based on JSON templates

Supports composition/aggregation with template references

Templates are parameterized, may include scripts, and support updates

Page 13: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

AWS Cloud Formation Snippet

Page 14: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

The Dark Side of Cloud Formation

User Data, BASH, and JSON

Page 15: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

The Design

Cloud Formation is used for provisioning not configuration

Boto creates AMIs and configures instances

Fabric as an execution framework

Page 16: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

The Process

Create AMIs In the appropriate regionsUpload Cloud Formation templates to S3

Spin up instances using Cloud Formation

Configure instances with Fabric

Page 17: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Create AMIs

Use the command:fab create_ami

Supports saving AMI to multiple regions

Differentiates between general and specific functions using ami_type

Update CF Templates with AMI ID

Page 18: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Upload to CF Templates to S3

Publish templates using:fab push_cf_templates_to_s3

Templates are stored in S3 buckets per region

Publish for changes/updates to templates

Page 19: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Cloud Formation

Page 20: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Wrap-Up

Does this scale?Python/Boto ease of us vs Cloud Formation’s declarative verbosity

Next iteration – fabric toolchain wrapping boto APIs

Page 21: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

FREE CODE !!!!! No copyright No terms of use No strings attached https://github.com/dixonwh/aws-provisioning

Page 22: Real World AWS Deployment With Boto, Fabric, and Cloud Formation

Questions?