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. AWS INFRASTRUCTURE DEPLOYMENT
    USING CLOUDFORMATION
    @SOYELSERGILLO

    View full-size slide

  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.

    View full-size slide

  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.

    View full-size slide

  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

    View full-size slide

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

    View full-size slide

  6. EASY WAY
    TEMPLATES ARE JUST
    JSON FILES

    View full-size slide

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

    View full-size slide

  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

    View full-size slide

  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

    View full-size slide

  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

    View full-size slide

  11. LET’S CREATE A TEMPLATE!

    View full-size slide

  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.

    View full-size slide

  13. LET’S
    DEPLOY A TEMPLATE

    View full-size slide

  14. ▸ 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

    View full-size slide

  15. ▸ 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.

    View full-size slide

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

    View full-size slide

  17. Sergio Moya
    THANKS!

    View full-size slide