A brief look into Cloudformation

In this blog, i just wanted to record details and my thoughts on following a first tutorial on Cloudformation. This is the free AWS offering for managing and provisioning infrastructure resources within a cloud environment - effectively their IaC service.

A cloud formation template describes a group of resources that form a stack. Resources can references resources within the template or outside of the stack entirely. Template can be written in JSON or YAML.

A stack is free in AWS but the resources within are priced as normal.

Templates have several useful features:
* Parameters
* Mappings for conditional values (eg AMI ID's differ between regions)
* Functions can be used to join values etc
* Output values

Ultimately i would like to compare and contrast with Terraformer.

Updating a stack

This tutorial describes how to update a stack implementing a sample PHP app on apache.

MetaData/Init section for an EC2 instance allows you to specify things like which packages are needed and config files (eg index.php) including file content. This is definitely in an area similar to other IaC tools now like ansible/puppet. In comparison it feels a bit clunky with everything so far being 'in-line'. It does provide a nice interface for ensuring services are running. 'cfn-init' added to the UserData section to install file and packages from MetaData section. cfn-hup is then installed and used to listen to changes in the MetaData section.

Stack can be updated via the AWS console or using the update-stack command. Again, the template file can be uploaded to S3 or referenced to S3 in the command. It can take up to 15 mins to take effect (since cfn-hup runs every 15 mins).

Bootstrapping applications

1) Cloudformation template. CloudInit/UserData contains executable items that fire at launch time. They form part of a common base for the AMI, There is a trade-off in launch time and flexibility here - as to whether you build a new customised AMI. UserData has a 16K limit. Generally more stuff is placed into the MetaData part.

2) Bake application into an Amazon Machine Image (AMI)

3) Integration with Chef and Puppet

Generally bootstrap the EC2 instance with the client software and separately deploy and configure a Chef server or Puppet master.

Comments

There is an obvious issue with the cfn-hup delay which may or may not be an issue

Previous experience has showed compatibility issues with installing cfn-hup and reliability issues which it is installed.




Image result for cloudformation

Comments

Popular posts from this blog