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

AWS infrastructure deployment using CloudFormation

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

Sergio Moya

January 12, 2016
Tweet

More Decks by Sergio Moya

Other Decks in Technology

Transcript

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

    OF RELA ROVISIONING AND UPD RLY AND PREDICTABLE
  5. ANATOMY OF A TEMPLATE ANATOMY OF A TEMPLATE ▸ Parameters

    ▸ Mappings ▸ Resources ▸ Outputs ▸ Conditions
  6. 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
  7. 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
  8. 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
  9. ▸ 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.
  10. ▸ 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
  11. ▸ 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.
  12. ▸ TOOLS DEPLOYMENT ▸ AWS CLI ▸ Boto Library (python)

    ▸ Stacker (uses Troposphere templates) ▸ Ansible (includes cloudformation module that uses boto). ▸ And more…