I want to install the AWS CloudFormation helper scripts with Ubuntu 16.04 LTS or RHEL 7 AMIs. How do I do this?

To use the CloudFormation helper scripts with Ubuntu 16.04 LTS or RHEL 7 AMIs, you must manually install them during the boot process. You can use UserData to automatically download and install the AMIs, and then start the service automatically at launch.

  1. Add the Ubuntu 16.04 LTS script or the RHEL 7 script to the UserData property of your instance.
  2. Create a service in systemd so the cfn-hup daemon starts automatically at boot. Note: systemd must become a dependency of an existing boot target. Use multi-user.target, which is similar to "start on runlevel [2345]" in Upstart.
  3. Set the instructions in the metadata property files key to create the cfn-hup configuration file, the cfn-hup hook, and the systemd file for cfn-hup /lib/systemd/systemcfn-hup.service.
  4. Use the commands key to enable the service in systemd and start it.

Verify after launching the stack that cfn-hup service has started by running the following command:

systemctl status cfn-hup

If cfn-hup is running, you receive output similar to the following:

cfn-hup.service - cfn-hup daemon    Loaded: loaded (/usr/lib/systemd/system/cfn-hup.service; enabled; vendor preset: disabled)    Active: active (running) since Wed 2016-10-12 08:10:26 EDT; 1min 11s ago  Main
PID: 4852 (cfn-hup)    CGroup: /system.slice/cfn-hup.service            └─4852 /usr/bin/python /opt/aws/bin/cfn-hup Oct 12 08:10:26 ip-172-31-44-180.ec2.internal systemd[1]: Started
cfn-hup daemon. Oct 12 08:10:26 ip-172-31-44-180.ec2.internal systemd[1]: Starting cfn-hup daemon...

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2018-06-29