CMSC389L

Week 15

Infrastructure as Code

Friday, December 8, 2017

  1. CloudFormation + Thumbnailer Demo
  2. CMSC389L Recap
  3. Final Evaluation Form

Today

CloudFormation

Cloud Infrastructure

Cloud systems are complex and with numerous components and relationships

Cloud Infrastructure

How do you manage these components over time?

https://www.slideshare.net/AmazonWebServices/deep-dive-aws-cloudformation

Cloud Infrastructure

How do you manage these components over time?

AWS Management Console?

  • Error-prone
  • Not repeatable
  • Not easily auditable
  • Time consuming + manual!

https://www.slideshare.net/AmazonWebServices/deep-dive-aws-cloudformation

Cloud Infrastructure

How do you manage these components over time?

AWS CLI? Boto3 scripts?

  • How to handle API failures?
  • Delete and re-create just to update the environment?
  • Roll backs?
  • Hard to track changes over time (Version control)

https://www.slideshare.net/AmazonWebServices/deep-dive-aws-cloudformation

Cloud Infrastructure

How do you manage these components over time?

 

Need a smart configuration tool

  • Declarative
    • Specify the state you want to achieve, let the tool figure out "how"
  • Can handle roll-backs
  • Abstracts away the AWS API 
  • Reproducible
    • staging => production?
  • Versionable (for example, with Git)

CloudFormation

  • Templates: YAML or JSON configuration files
  • Stacks: Groups of resources created by a template
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
Resources:
  MyEC2Instance:
    Type: "AWS::EC2::Instance"
    Properties: 
      ImageId: "ami-2f726546"
      InstanceType: t1.micro
      KeyName: testkey
      BlockDeviceMappings:
        -
          DeviceName: /dev/sdm
          Ebs:
            VolumeType: io1
            Iops: 200
            DeleteOnTermination: false
            VolumeSize: 20
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "A sample template",
  "Resources": {
    "MyEC2Instance": {
      "Type": "AWS::EC2::Instance",
      "Properties": {
        "ImageId": "ami-2f726546",
        "InstanceType": "t1.micro",
        "KeyName": "testkey",
        "BlockDeviceMappings": [
          {
            "DeviceName": "/dev/sdm",
            "Ebs": {
              "VolumeType": "io1",
              "Iops": 200,
              "DeleteOnTermination": false,
              "VolumeSize": 20
            }
          }
        ]
      }
    }
  }
}

CloudFormation

Real World Deployment

  • Goal: automate everything, beginning-to-end
    • Continuous Integration: Test every commit
    • Continuous Deployment: Push code live as quickly as possible
  • CloudFormation is critical here, so that:

    • Infra changes occur in parallel with application changes
    • Infra changes occur automatically, with no human interaction
    • Infra changes are reproducible on staging vs. production

Thumbnailer with CloudFormation!

CMSC389L Recap!

This Semester

Networking

Compute

Data

  • ALBs
  • API Gateway
  • EC2
  • Lambda
  • ECS + Docker
  • S3
  • DynamoDB
  • Elasticsearch
  • CloudFront
  • SQS

Infrastructure Management

  • CloudFormation
  • Auto Scaling

Remember This?

What did we not cover?

Networking

Compute

Data

  • Route53 (DNS)
  • Shield (DDoS)
  • ...
  • Elastic Beanstalk
  • Elastic Map Reduce
  • Athena
  • ...
  • Aurora
  • RDS
  • Kinesis
  • ...

Infrastructure Management

  • OpsWorks
  • VPCs

Resources

Lots of great resources:

Final Evaluation Form

Closing Notes

  • Final Project Deadlines:
    • Friday, 12/15: Code
    • Saturday, 12/16: Video Demo
    • By 12/19: In-person Demo
  • Sign up on Piazza for a presentation spot!

CMSC389L Week 15

By Colin King

CMSC389L Week 15

  • 625