artem zhurbila 5 aws - cloud formation and beanstalk
TRANSCRIPT
Agenda1. CloudFormation overview2. CloudFormation template structure3. CloudFormer4. Elastic Beanstalk overview5. Deploy Docker image
2
CloudFormation3
- Control AWS infrastructure in predictable way (infrastructure as code)
- You don’t need to figure out the order for provisioning of AWS services
- no additional charge- JSON-formatted template (Declarative style)- By default, “automatic rollback on error” feature is
enabled. Stacks can be fully created, or not at all.
AWS Test Drive
AWS Test Drive - sandbox containing preconfigured server based solutions. Using a step-by-step lab manual and video, launch, login and learn about these popular 3rd party IT solutions, powered by AWS and CloudFormation.
4
Intrinsic Function ● Fn::Base64● Condition Functions
Fn::AndFn::EqualsFn::IfFn::NotFn::Or
7
● Fn::FindInMap● Fn::GetAtt● Fn::GetAZs● Fn::Join● Fn::Select● Ref
Pseudo Parameters Reference● AWS::AccountId● AWS::Region● AWS::StackName
8
"Outputs" { "MyStacksRegion" : { "Value" : { "Ref" : " AWS::Region" } }}
Resources types
● AWS::AutoScaling::AutoScalingGroup
● AWS::AutoScaling::LaunchConfiguration
● AWS::AutoScaling::ScalingPolicy● AWS::AutoScaling::
ScheduledAction● AWS::CloudFront::Distribution● AWS::CloudTrail::Trail● AWS::CloudWatch::Alarm● AWS::DynamoDB::Table● AWS::EC2::CustomerGateway● AWS::EC2::DHCPOptions● AWS::EC2::EIP● AWS::EC2::EIPAssociation
10
● AWS::EC2::NetworkInterface● AWS::EC2::
NetworkInterfaceAttachment● AWS::EC2::Route● AWS::EC2::RouteTable● AWS::EC2::SecurityGroup● AWS::EC2::Volume● AWS::EC2::VolumeAttachment● AWS::EC2::VPC● AWS::EC2::
VPCDHCPOptionsAssociation● AWS::EC2::
VPCGatewayAttachment● AWS::EC2::VPCPeeringConnection● etc
Outputs
"Outputs" : { "Logical ID" : { "Value" : "Value to return", "Description" : "Information about the value" }}
12
Stack
Stack - collection of AWS resources that result from instantiating a template. Stack = template + input parameters
13
Bootstrapping ApplicationsPython helper scripts (preinstalled on Amazon Linux AMI in /opt/aws/bin):1. cfn-get-metadata: Retrieve metadata (key-value) attached to resources in
the template.2. cfn-init: install packages and files described in AWS::CloudFormation::Init.3. cfn-signal: signal to the stack creation workflow that your application is
ready to take traffic. Signal an CloudFormation CreationPolicy or WaitCondition
4. cfn-hup: daemon to listen for stack updates and execute hooks to react to those changes.
You can use CloudFormation scripts on their own or in conjunction with CloudInit (official Ubuntu EC2 AMI support it).
20
Ways to deploy Docker app1. Create a Dockerfile to deploy a Docker container to
AWS Elastic Beanstalk.2. Create a Dockerrun.aws.json file to deploy a Docker
container from an existing Docker image3. Create a .zip file containing any application file
dependencies, the Dockerfile or Dockerrun.aws.json
27