AWS Under the Hood

Orchestration by Amazon Web Service

Gianluca Arbezzano

Software Engineer at CurrencyFair

OpenSource maintainer

twitter.com/gianarb - github.com/gianarb

Docker Captain and DevOps culture's follower

twitter.com/gianarb - github.com/gianarb

Orchestration

Orchestration is the automated arrangement, coordination, and management of complex computer systems, middleware and services.

cit. Wikipedia

Automation

Make reproducible tasks less boring

AwServices!!

AWS is a big provider of a lot of different services
We need a way to order all the things!

AWS CloudFormation 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.

Flexible and declarative

Customized via parameters

It provisions AWS resources in order

Reusable

Template

it is a JSON formatted file. It describes PARAMTERS, RESOURCES and ACTION

CloudFormation platform to create, delete and update stacks and manage errors and rolbacks.

Stack

When you use AWS CloudFormation, you manage related resources as a single unit called a stack.

Change set

you can generate a change set, which is summary of your proposed changes.

Welcome into the infrastructure as a code world!

versioning, update, delete fast


{
  "Parameters" : {
    "VPCName" : {
      "Type" : "String",
      "Default" : "staging",
      "Description" : "VPC name"
    }
  },
  "Resources" : {
    "Staging": {
       "Type" : "AWS::EC2::VPC",
       "Properties" : {
          "CidrBlock" : "10.15.0.0/16",
          "EnableDnsSupport" : true,
          "EnableDnsHostnames" : true,
          "InstanceTenancy" : "default",
          "Tags" : [{"Key": "Name", "Value": {"Ref": "VPCName"}}]
       }
    }
  }
}
                

{
    "Resources" : {
        "Staging": {
           "Type" : "AWS::EC2::VPC",
           "Properties" : {
              "CidrBlock" : "10.15.0.0/16",
              "EnableDnsSupport" : true,
              "EnableDnsHostnames" : true,
              "InstanceTenancy" : "default",
              "Tags" : [{"Key": "Name", "Value": {"Ref": "VPCName"}}]
           }
        },
        "DatabaseSubnet1": {
          "Type" : "AWS::EC2::Subnet",
          "Properties" : {
            "AvailabilityZone" : "eu-west-1a",
            "CidrBlock" : "10.15.1.0/28",
            "MapPublicIpOnLaunch" : true,
            "VpcId": {"Ref" : "Staging"},
            "Tags": [{"Key": "Name", "Value": "db-1a"}]
          }
        }
    }
}
                    

github.com/cloudtools/troposphere

Usually the template become really big and difficult to maintain, troposphere helps you to manage and create templates.

AWS CloudFormation Designer

but remember, it's just a JSON.
Demo time
AWS CLI

    aws cloudformation create-stack

        --stack-name devops_stage

        --template-body file:///home/gianarb/devops.json

        --parameters VPCName=staging,AppName=test
                    

Manage your application

codedeploy, Elastic Beanstalk..

Some tricks

  • Use parameters with caution
  • Use the best practice that you use without cloudformation

Case studies

  • gilt/nova: Collection of utilities to easily deploy services to AWS.
  • serverless/serverless Framework to manage serverless application
  • Your continuous integration pipeline
  • If you are a consultant it's a great way to build an infrastructure for your client and leave that managable without you

Thanks!

gianarb.it

twitter.com/gianarb - github.com/gianarb