Slide 1

Slide 1 text

AWS INFRASTRUCTURE DEPLOYMENT USING CLOUDFORMATION @SOYELSERGILLO

Slide 2

Slide 2 text

DISCLAIMER ▸ I’m not a Sysadmin. Please excuse me if there is any best and most secure way to create the stack shown in these slides. However, I want to add that these slides are only intended to display a summary of the main CloudFormation features, and how it becomes easy to use even for someone without sysadmin skills. Thanks.

Slide 3

Slide 3 text

TABLE OF CONTENTS ▸ What is Cloudformation. ▸ Anatomy of a template. ▸ Let’s create a template (Demo). ▸ Let’s deploy the template (Demo). ▸ Playground (Demo). ▸ Tools and other stuff.

Slide 4

Slide 4 text

GIVES DEVELOPERS AND SYSTEMS ADMINISTRATORS AN EASY WAY TO CREATE AND MANAGE A COLLECTION OF RELATED AWS RESOURCES, PROVISIONING AND UPDATING THEM IN AN ORDERLY AND PREDICTABLE FASHION. https://aws.amazon.com/cloudformation WHAT IS CLOUDFORMATION

Slide 5

Slide 5 text

DEVELOPERS AND SYS TORS AN EASY WAY TO A COLLECTION OF RELA ROVISIONING AND UPD RLY AND PREDICTABLE

Slide 6

Slide 6 text

EASY WAY TEMPLATES ARE JUST JSON FILES

Slide 7

Slide 7 text

ANATOMY OF A TEMPLATE ANATOMY OF A TEMPLATE ▸ Parameters ▸ Mappings ▸ Resources ▸ Outputs ▸ Conditions

Slide 8

Slide 8 text

ANATOMY OF A TEMPLATE PARAMETERS "Environment": { "Default": "hello-world-demo", "Description": "The current environment", "Type": "String", "AllowedValues": [“prod”, “hello-world-demo"] } HTTP://DOCS.AWS.AMAZON.COM/AWSCLOUDFORMATION/LATEST/ USERGUIDE/PARAMETERS-SECTION-STRUCTURE.HTML

Slide 9

Slide 9 text

ANATOMY OF A TEMPLATE MAPPINGS "RegionDetails": { "us-east-1": { "AZ": "us-east-1a", "KeyName": "hello-world-demo", "AMI": "ami-60b6c60a" } } HTTP://DOCS.AWS.AMAZON.COM/AWSCLOUDFORMATION/LATEST/ USERGUIDE/MAPPINGS-SECTION-STRUCTURE.HTML

Slide 10

Slide 10 text

ANATOMY OF A TEMPLATE RESOURCES "OurSecurityGroup": { "Type": "AWS::EC2::SecurityGroup", "Properties": { "GroupDescription": "Port 22 to all ip's", "VpcId": {"Ref": "OurVPC"}, "SecurityGroupIngress": [ { "IpProtocol": "tcp", "FromPort": "22", "ToPort": "22", "CidrIp": "0.0.0.0/0" } ] }} HTTP://DOCS.AWS.AMAZON.COM/AWSCLOUDFORMATION/LATEST/ USERGUIDE/AWS-TEMPLATE-RESOURCE-TYPE-REF.HTML

Slide 11

Slide 11 text

LET’S CREATE A TEMPLATE!

Slide 12

Slide 12 text

▸ LET’S CREATE A TEMPLATE REQUIREMENTS OF OUR STACK ▸ Web application that serves a simple website with a Hello World text. ▸ Should use t2.small instances. ▸ Should auto scale automatically on high cpu load. ▸ Port 80 should be accessible by anyone. ▸ The rest of ports should be opened ONLY for our office ip’s.

Slide 13

Slide 13 text

DEMO TIME!

Slide 14

Slide 14 text

LET’S DEPLOY A TEMPLATE

Slide 15

Slide 15 text

▸ PLAYGROUND DO YOU WANT TO TEST OUR STACK? ▸ Is the Load Balancer working? ▸ Let’s test our autoscaling strategy. ▸ Let’s test our Load Balancer health check. ▸ Is our Security Group working ok?. ▸ Etc

Slide 16

Slide 16 text

▸ TOOLS TEMPLATE CREATION AND WRAPPERS ▸ CloudFormation Designer by Amazon AWS (Website) ▸ Troposphere (in python). - wrapper ▸ puppetlabs/cloudformation (Puppet module) - wrapper ▸ And more… DO NOT USE ANY IF YOU DONT REALLY NEED THEM. IT’S BETTER LEARN HOW IT WORKS DIRECTLY AND CRAFT JSON TEMPLATES DIRECTLY.

Slide 17

Slide 17 text

▸ TOOLS DEPLOYMENT ▸ AWS CLI ▸ Boto Library (python) ▸ Stacker (uses Troposphere templates) ▸ Ansible (includes cloudformation module that uses boto). ▸ And more…

Slide 18

Slide 18 text

Sergio Moya THANKS!