Automate one small task
Suppose every practice server needs the same package and configuration file. I would turn those steps into a short script and test them. Keep the script with your notes so that you can explain exactly how the server was prepared.
Check when execution happens
Common Linux cloud-init configurations run user-data scripts during the initial launch by default. Do not assume every reboot repeats the setup. Read the image-specific behaviour and inspect the relevant logs before deciding that the script has failed.
Keep credentials out
User data is configuration, not a safe place for passwords. Use an appropriate instance role and secret-management approach where required. Log useful progress without exposing sensitive values. Also consider whether rerunning a step would duplicate or damage configuration.
Try it yourself
Write a startup plan that installs a package, creates a non-sensitive configuration and starts a service. Add a verification step for each.
A common question
Why did the script not run after reboot?
Initial-launch execution is a common default. Repeated execution needs intentional configuration appropriate to the image.
References & video notes
Use the video to follow the topic with me. Console screens and older offers can change, so check the current AWS documentation before performing a lab.
Keep learning
- What is Amazon EC2? A beginner’s guide
- What is an AMI? Understanding EC2 machine images
- Plan and launch your first EC2 instance