Created
October 29, 2025 17:38
-
-
Save thimslugga/5840af7a3403d5726517f5581fe5e42b to your computer and use it in GitHub Desktop.
Cloud Config i.e. Userdata that runs every single boot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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