Skip to content

Instantly share code, notes, and snippets.

@thimslugga
Created October 29, 2025 17:38
Show Gist options
  • Save thimslugga/5840af7a3403d5726517f5581fe5e42b to your computer and use it in GitHub Desktop.
Save thimslugga/5840af7a3403d5726517f5581fe5e42b to your computer and use it in GitHub Desktop.
Cloud Config i.e. Userdata that runs every single boot
#cloud-config-archive
# vim:syntax=yaml
- type: "text/cloud-config"
content: |
cloud_final_modules:
- [scripts-user, always]
- type: "text/x-shellscript"
content: |
#!/bin/bash
exec > >(tee /var/log/user-data.log | logger -t user-data -s 2>/dev/console) 2>&1
echo "$(date): Start UserData Script."
touch /root/boot.txt
echo "$(date): Executing UserData Script.." >> /root/boot.txt
echo "$(date): Enable and start the Amazon SSM Agent service."
systemctl daemon-reload
systemctl enable --now --no-block amazon-ssm-agent.service
echo "$(date): Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment