In this video Jeff Winesett introduces AWS cloudformation. An infrastructure management and deployment service that allows complicated application stacks to be replicated across regions and AWS accounts.
- (Voiceover) Another service offered by AWS to consider when designing application deployment and configuration management processes to best realize designing for elasticity is something called CloudFormation. AWS CloudFormation gives developers and systems administrators a easy way to create and manage a collection of related AWS resources. It allows for the definition of an entire application stack to exist as either a single or set of text based template files.
Version controlled systems can then be used to manage different versions of the application infrastructure. Here is a representation of a full stack one might have on AWS. It's pretty clear that this is using a combination of many different AWS resources and solutions to architect the system. It's load balancing across two web application servers. Which are communicating with an app server tier deployed using elastic beanstalk.
Also this app here is using both elastic cache, which is an in memory distributed cache storage service. And RDS which has been deployed in multi availability zone mode, using a cluster of rereplicas. There's a lot going on in this application stack. CloudFormation allows you to condense all of this down to a single or set of descriptive text based files. Which look something like this here.
You can then use these files to quickly and consistently rebuild the entire stack. This is a basic CloudFormation template. These templates use JSON to describe the needed specifications. Each template has a resources property which are the components or services you need to create. You specify a logical resource name which can be anything that makes sense to the company or the project. Each resource has a type property.
Which as it's name suggests identifies the type of AWS resource this is referring to. Here we see it as specifying Ec2Instance as the resource type. Properties of the resource are then specified, which of course will depend on the type of resource. In this case, since the resource type is an Ec2Instance, the properties are what is needed in order to launch the new instance. Things like which AMI identifier to use, and the instance size to create.
The same things that must be specified when launching an Ec2Instance from the management console. Another thing to note is that access keys must be specified when creating resources. And so far in this example, this value has been hard coded into the template. That can certainly be a problem if these template files would be shared with other users or used in different accounts. A better approach would be to allow each user to pass in their own specific values to variable properties.
CloudFormation templates allow for this. A parameters object can be defined in the template. And then declared parameters can be referenced as place holder values for the properties. The actual values will be passed in at the time this template file is being used to create the new resources. There is also an allowed values list that will restrict what the user could input. Providing even more control over how these template files can and cannot be used.
In fact this is only scratching the surface of what can be done with CloudFormation templates. And while the syntax and structure is fairly straightforward they can certainly get very complicated. Especially for stacks with a lot of different components. Luckily Amazon helps us out there as well with a tool called CloudFormer. To get started using CloudFormer, you would initially create the application stack via the console or API tools as normal.
CloudFormer helps to create a CloudFormation template from an existing stack. Then you create and launch a CloudFormer stack. CloudFormer is itself an AWS CloudFormation stack. It runs on a single micro instance and does not need any additional resources. The CloudFormer tool can then be used to create a CloudFormation template file from the existing stack. Then the CloudFormation stack is shutdown, as it is not needed beyond it's utility to help create the template files.
The final product is a CloudFormation template to be used as needed. Implementing Elasticity Lesson number five. Use CloudFormation templates to manage and version-control your entire AWS application stack, and easily replicate your full stacks to new environments, new accounts, or new geographical regions.
- Benefits of cloud services
- Making architectures scalable
- Examining cloud constraints
- Virtual servers, EC2, and Elastic IP
- Using the Amazon machine image
- Elastic load balancing
- Using CloudWatch for monitoring
- Security Models
- Elastic block storage
- S3, CloudFront, and Elastic Beanstalk
- Handling queues, workflows, and notifications
- Caching options and services
- Identity and access management
- Creating a custom server image
- Application deployment strategies
- Serverless architectures