Bootstrapping Applications using AWS CloudFormation

Sample Code & Libraries>AWS CloudFormation>Bootstrapping Applications using AWS CloudFormation
Community Contributed Software

  • Amazon Web Services provides links to these packages as a convenience for our customers, but software not authored by an "@AWS" account has not been reviewed or screened by AWS.
  • Please review this software to ensure it meets your needs before using it.

If you are installing and configuring your applications on EC2 dynamically at instance launch time, you will typically need to pull and install packages, deploy files and ensure services are started. AWS CloudFormation provides a set of helper scripts that, in conjunction with resource metadata defined in the template, can be used to install software and start services when you build your stack.


Submitted By: ChrisW@AWS
AWS Products Used: AWS CloudFormation
Language(s): AWS CloudFormation Template
Created On: September 30, 2011 5:44 AM GMT
Last Updated: January 12, 2015 7:53 PM GMT
For more details of using AWS CloudFormation to install and configure application, for more details see:

Change history:

  • 1/12/2015: The source distribution's dependency on python-daemon has been locked to pre-2.0 versions. S3 URLs with spaces can now be downloaded from region-specific S3 endpoints. The certificate bundle can be overriden by a PEM-encoded cert bundle at /etc/cfn/ca-override.pem or %SYSTEMDRIVE%\cfn\ca-override.pem
  • 11/06/2014: Ability to use cfn-signal in conjunction with CreationPolicy as per the details here

AWS CloudFormation provides the following helpers to allow you to deploy your application code or application and OS configuration at the time you launch your EC2 instances:

  • cfn-init: Used to retrieve and interpret the resource metadata, installing packages, creating files and starting services.
  • cfn-signal: A simple wrapper to signal a CloudFormation WaitCondition allowing you to synchronize other resources in the stack with the application being ready.
  • cfn-get-metadata: A wrapper script making it easy to retrieve either all metadata defined for a resource or path to a specific key or subtree of the resource metadata.
  • cfn-hup: A daemon to check for updates to metadata and execute custom hooks when the changes are detected.

These scripts are installed by default on the latest Amazon Linux AMI in /opt/aws/bin. They are also available in the Amazon Linux AMI yum repository for previous versions of the Amazon Linux AMI as well as via RPM for other Linux/Unix distributions. The scripts can also be installed on Microsoft Windows using Python for Windows.

  • The AWS helper scripts are available in the Amazon Linux AMI yum repository (the package name is aws-cfn-bootstrap) for previous versions of the Amazon Linux AMI.
  • The RPM package for the Amazon Linux AMI is also available here.
  • A source RPM package is available for other Linux distributions here.
  • A Python easy-install package is available here.
  • A ZIP archive is available here.
  • Windows MSI file is available for 32bit Windows and 64bit Windows. To deploy to Windows, you also need to download the Microsoft Visual C++ 2008 Redistributable Package from here
©2016, Amazon Web Services, Inc. or its affiliates. All rights reserved.