Configuring CloudFormation Init Metadata
The most complex piece of configuration you have performed so far in our stack is the UserData
property, defined as part of the Auto Scaling launch configuration.
Recall in the previous chapter when you created a custom machine image, you installed the cfn-bootstrap
CloudFormation helper scripts, which include the cfn-init
and cfn-signal
scripts that are referenced in the previous example. These scripts are designed to work with a feature known as CloudFormation Init metadata, which we will configure now, as demonstrated in the following example:
... ... Resources: ... ... ApplicationAutoscalingLaunchConfiguration: Type: AWS::AutoScaling::LaunchConfiguration Metadata: AWS::CloudFormation::Init: config: commands: 05_public_volume: command: mkdir -p /data/public 06_public_volume_permissions: command: chown -R 1000:1000 /data/public 10_first_run: command...