Tuesday, October 4, 2016

AWS CDA Study List - CloudFormation

CloudFormation

Basics

  • Free, but resources it creates are billed normally
  • Service to create resources based on templates
    • JSON -based text file
    • YAML -based text file
  • Supports for example creating
    • VPCs
    • Subnets
    • Gateways
    • Route Tables
    • Network ACLs
    • Elastic IPs
    • EC2 Instances
    • EC2 Security Groups
    • Auto Scaling Groups
    • Elastic Load Balancers
    • RDS Database Instances
    • RDS Security Groups in VPC
  • Can be used to bootstrap Chef and Puppet
  • Supports software installation by application bootstrapping scripts
  • Differs from Elastic Beanstalk in the that CloudFormation creates resources whereas Elastic Beanstalk is used to create applications
  • Deleting stack also deletes stack resources
    • Deletion policy must be used to avoid resource deletion

Limits

  • No limit for templates or stacks
  • Maximum number of resources in stack is 200
  • Maximum number of AWS CloudFormation stacks per AWS root account is 200
  • 60 parameters and 60 outputs are allowed in template

Defaults

  • By default CloudFormation stack is rolled back if stack creation fails
Following topics are exam questions collected through Internet and should be evaluated as so. Answers are mine and have been checked with answers collected through the internet, but might still be wrong.

CloudFormation stack creation defaults

What happens, by default, when one of the resources in a CloudFormation stack cannot be created?

A. The stack creation continues, and the final results indicate which steps failed.
B. CloudFormation templates are parsed in advance so stack creation is guaranteed to  succeed.
C. Previously-created resources are kept but the stack creation terminates.
D. Previously-created resources are deleted and the stack creation terminates.

Why? 

https://aws.amazon.com/cloudformation/faqs/

Q: What happens when one of the resources in a stack cannot be created successfully?

By default, the “automatic rollback on error” feature is enabled. This will cause all AWS resources that AWS CloudFormation created successfully for a stack up to the point where an error occurred to be deleted. This is useful when, for example, you accidentally exceed your default limit of Elastic IP addresses, or you don’t have access to an EC2 AMI you’re trying to run. This feature enables you to rely on the fact that stacks are either fully created, or not at all, which simplifies system administration and layered solutions built on top of AWS CloudFormation


CloudFormation

Which code snippet below returns the URL of a load balanced web site created in CloudFormation with an AWS::ElasticLoadBalancing::LoadBalancer resource name “ElasticLoad Balancer”?

A. “Fn::Join” : [“”. [ “http://”, {“Fn::GetAtr” : [ “ElasticLoadBalancer”,”DNSName”]}]]
B. “Fn::Join” : [“.”, [ “http://”, {“Ref” : “ElasticLoadBalancerDNSName”}]]
C. “Fn::Join” : [“”. [ “http://”, {“Ref” : “ElasticLoadBalancerUrl”}]]
D. “Fn::Join” : [“”. [ “http://”, {“Fn::GetAtr” : [ “ElasticLoadBalancer”,”Url”]}]]

Why?

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/example-templates-autoscaling.html

"Outputs" : {
    "URL" : {
      "Description" : "The URL of the website",
      "Value" :  { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]}
    }
  }
}

No comments:

Post a Comment