CMSC389L
Week 15
Infrastructure as Code
Friday, May 4, 2018
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
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:
- A Cloud Guru
- Open Guide to AWS
- AWS Whitepapers
- Hackathons, especially when AWS employees attend
Wrapping Up
Final Presentation sign-ups on Piazza later today
Video Demo / Code due May 11
CL8 on DynamoDB due May 10
Course Evals
CMSC389L Spring 2018 Week 15
By arasevic
CMSC389L Spring 2018 Week 15
- 430