CloudFormation Helper Scripts
Learn about the CloudFormation helper scripts and how helper scripts perform tasks beyond the basic capabilities of CloudFormation.
We'll cover the following...
In this lesson, we’ll also explore performing tasks that go beyond the basic capabilities of CloudFormation templates, specifically when we want to install and configure services on resources, like EC2 instances, provisioned within the stack.
For this purpose, we’ll be using specialized scripts provided by AWS CloudFormation that we can execute inside the runtime of an EC2 instance to initialize, configure, and manage any packages and services on the EC2 instance.
Using CloudFormation helper scripts
The CloudFormation helper scripts help us initialize and configure any runtime-based AWS resources, like EC2 instances, that are provisioned using AWS CloudFormation templates. These helper scripts also allow us to manage the runtime even after it’s initialized. The following diagram lists all the helper scripts provided by CloudFormation:
Let’s briefly explore all the CloudFormation helper scripts together with an example:
cfn-init
helper script
The cfn-init
helper script facilitates us in configuring an EC2 instance by executing the required set of initialization commands defined in the AWS::CloudFormation::Init
section of the metadata. We can leverage the cfn-init
helper script to install packages, create files, configure services, and perform other actions. Here are some of the common parameters for the cfn-init
helper script:
-s
|--stack
: We provide the ID or name of the stack that contains the resource. ...