Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AWS infrastructure deployment using CloudFormation

0d83f514dfdd88bd9315481cee61fda8?s=47 Sergio Moya
January 12, 2016

AWS infrastructure deployment using CloudFormation

Lightning talk guide. The core of this talk is the demo, which will be attached once I've got it.

Code used on this talk: https://github.com/smoya/cloudformation-hello-world

0d83f514dfdd88bd9315481cee61fda8?s=128

Sergio Moya

January 12, 2016
Tweet

Transcript

  1. AWS INFRASTRUCTURE DEPLOYMENT USING CLOUDFORMATION @SOYELSERGILLO

  2. 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.
  3. 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.
  4. 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
  5. DEVELOPERS AND SYS TORS AN EASY WAY TO A COLLECTION

    OF RELA ROVISIONING AND UPD RLY AND PREDICTABLE
  6. EASY WAY TEMPLATES ARE JUST JSON FILES

  7. ANATOMY OF A TEMPLATE ANATOMY OF A TEMPLATE ▸ Parameters

    ▸ Mappings ▸ Resources ▸ Outputs ▸ Conditions
  8. 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
  9. 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
  10. 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
  11. LET’S CREATE A TEMPLATE!

  12. ▸ 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.
  13. DEMO TIME!

  14. LET’S DEPLOY A TEMPLATE

  15. ▸ 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
  16. ▸ 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.
  17. ▸ TOOLS DEPLOYMENT ▸ AWS CLI ▸ Boto Library (python)

    ▸ Stacker (uses Troposphere templates) ▸ Ansible (includes cloudformation module that uses boto). ▸ And more…
  18. Sergio Moya THANKS!