Transcript
Page 1: Deep Dive: AWS CloudFormation
Page 2: Deep Dive: AWS CloudFormation
Page 3: Deep Dive: AWS CloudFormation
Page 4: Deep Dive: AWS CloudFormation
Page 5: Deep Dive: AWS CloudFormation
Page 6: Deep Dive: AWS CloudFormation
Page 7: Deep Dive: AWS CloudFormation
Page 8: Deep Dive: AWS CloudFormation
Page 9: Deep Dive: AWS CloudFormation

Elastic Beanstalk OpsWorks CloudFormation EC2

Convenience Control

Higher-level services Do it yourself

Page 10: Deep Dive: AWS CloudFormation
Page 11: Deep Dive: AWS CloudFormation

Continuous integration for your complete stack

Version Control Jenkins

Test

Live

Amazon

S3

AWS

CloudFormation

App commit

Infra commit

Pull

Deploy new

template

Deploy

new app

Page 12: Deep Dive: AWS CloudFormation

Continuous integration for your complete stack

Version Control Jenkins

Test

Live

Amazon

S3

AWS

CloudFormation

App commit

Infra commit

Pull

Promote new

template

Promote

new app

Page 13: Deep Dive: AWS CloudFormation
Page 14: Deep Dive: AWS CloudFormation

"Parameters"

"Mappings"

"Conditions"

"Resources"

"Outputs"

Page 15: Deep Dive: AWS CloudFormation
Page 17: Deep Dive: AWS CloudFormation
Page 18: Deep Dive: AWS CloudFormation
Page 19: Deep Dive: AWS CloudFormation

"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}

Page 20: Deep Dive: AWS CloudFormation

"Outputs" : {

"InstancePublicDnsName" : {

"Description" : "The public DNS name of the newly created EC2 instance",

"Value" : { ”Fn::GetAtt" : [ "Ec2Instance”, “PublicDnsName” ] }

}

}

Page 21: Deep Dive: AWS CloudFormation

"MountPoint" :

{

"Type" : "AWS::EC2::VolumeAttachment",

"Condition" : "CreateProdResources",

"Properties" : {

"InstanceId" : { "Ref" : "EC2Instance" },

"VolumeId" : { "Ref" : "NewVolume" },

"Device" : "/dev/sdh“

}

}

Page 22: Deep Dive: AWS CloudFormation

http://aws.amazon.com/cloudformation/aws-

cloudformation-templates/

http://docs.aws.amazon.com/AWSCloudFormation/latest/U

serGuide/CHAP_TemplateQuickRef.html

Page 24: Deep Dive: AWS CloudFormation
Page 25: Deep Dive: AWS CloudFormation
Page 26: Deep Dive: AWS CloudFormation
Page 27: Deep Dive: AWS CloudFormation

"Metadata" : {

"AWS::CloudFormation::Init" : {

"webapp-config": {

"packages" : {},

"sources" : {},

"files" : {},

"groups" : {},

"users" : {},

"commands" : {},

"services" : {}

}

}

},

Page 28: Deep Dive: AWS CloudFormation

"packages" : {},

"sources" : {},

"files" : {},

"groups" : {},

"users" : {},

"commands" : {},

"services" : {}

Page 29: Deep Dive: AWS CloudFormation

Managing your stacks

Page 30: Deep Dive: AWS CloudFormation

Frontend Services

• E-Commerce Website

Backend Services

• Search, Payment Gateway, Reviews, Recommendations

Shared Services

• Common Monitoring tools, Queues

Base Network

• VPCs, Subnets, VPNs, NATs

Identity • IAM Users, Groups, Roles

Page 31: Deep Dive: AWS CloudFormation

E-Commerce Website Recommendations Engine

"Parameters" : {

“RecommendationsEndPoint” : {

“Description” : “URL of the recommendations ELB”,

“Type” : “String”

}

},

"Outputs" : {

"RecommendationsEndPoint" : {

"Description" : "URL of the recommendations ELB",

"Value" : { ”Fn::GetAtt" : [ "RecommendationsELB”, “PublicDnsName” ] }

}

}

Page 32: Deep Dive: AWS CloudFormation

ELB_AND_AS

“Resources” : {

“ELB”,

“AutoScaling”

}

Website1

“Resources” : {

“NestedStack”,

“RDS”

}

Website2

“Resources” : {

“NestedStack”,

“DynamoDB”

}

Website1

“Resources” : {

“ELB”,

“AutoScaling”,

“RDS”

}

Website2

“Resources” : {

“ELB”,

“AutoScaling”,

“DynamoDB”

}

Page 33: Deep Dive: AWS CloudFormation
Page 34: Deep Dive: AWS CloudFormation

Amazon

Route 53

Page 35: Deep Dive: AWS CloudFormation

"UpdatePolicy" : {

"AutoScalingRollingUpdate" : {

"MaxBatchSize" : “2”,

"MinInstancesInService" : ”2”,

"PauseTime" : “PT20M”

}

}

Page 36: Deep Dive: AWS CloudFormation
Page 37: Deep Dive: AWS CloudFormation
Page 38: Deep Dive: AWS CloudFormation

"UpdatePolicy": {

"AutoScalingRollingUpdate": {

"PauseTime": "PT0S",

"MaxBatchSize": “6",

"MinInstancesInService": "0"

}

}

"UpdatePolicy": {

"AutoScalingRollingUpdate": {

"PauseTime": "PT15S",

"MaxBatchSize": "2",

"MinInstancesInService": "2"

}

}

Page 39: Deep Dive: AWS CloudFormation
Page 40: Deep Dive: AWS CloudFormation
Page 41: Deep Dive: AWS CloudFormation
Page 42: Deep Dive: AWS CloudFormation
Page 43: Deep Dive: AWS CloudFormation
Page 44: Deep Dive: AWS CloudFormation
Page 45: Deep Dive: AWS CloudFormation
Page 46: Deep Dive: AWS CloudFormation
Page 47: Deep Dive: AWS CloudFormation

AWS::EC2::VPC::Id

List<AWS::EC2::Subnet::Id>

List<AWS::EC2::SecurityGroup::Id>

AWS::EC2::KeyPair::KeyName

Page 48: Deep Dive: AWS CloudFormation

{

"AWSTemplateFormatVersion" : "2010-09-09",

"Resources" : {

"myS3Bucket" : {

"Type" : "AWS::S3::Bucket",

"DeletionPolicy" : "Retain"

"Properties" : {

"BucketName" : “MyBucket”

}

}

}

}

{

"AWSTemplateFormatVersion" : "2010-09-09",

"Resources" : {

"myVolume" : {

"Type":"AWS::EC2::Volume",

"DeletionPolicy" : "Snapshot”

"Properties" : {

"AvailabilityZone" :”us-east-1a”,

"Size” : “100”

}

}

}

}

MyBucket myVolume Snapshot

Page 49: Deep Dive: AWS CloudFormation

“Do not update the databases”

"Effect" : "Deny",

"Principal" : "*",

"Action" : "Update:*",

"Resource" : "*",

"Condition" : {

"StringEquals" : {

"ResourceType” : [

"AWS::RDS::DBInstance”,

"AWS::Redshift::Cluster”

]

}

}

“Okay to update, unless the update requires replacement”

"Effect" : "Deny",

"Principal": "*",

"Action" : "Update:Replace",

"Resource" : "LogicalResourceId/MyInstance"

Page 50: Deep Dive: AWS CloudFormation

{

"Version": "2012-10-17",

"Statement": [

{

"Effect": ”Deny",

"Action": “*",

"Resource": "*"

},

{

"Effect" : ”Allow",

"Action" : [

"Action": "ec2:Describe*”

],

"Condition": {

"Null": { "ec2:ResourceTag/*cloudformation*" : "true" }

},

"Resource" : "*"

}

]

}

Page 51: Deep Dive: AWS CloudFormation
Page 52: Deep Dive: AWS CloudFormation

Top Related