- Newest
- Most votes
- Most comments
UserData Script Re-run with EBS-backed EC2 Instances:
Yes, the UserData script is re-run when the instance is restarted due to an update in the CloudFormation template.
Cannot re-run only parts: The UserData script runs in its entirety upon restart. It cannot selectively re-run only parts of the script.
Best Practices for Software Maintenance via UserData:
Considerations for Re-running UserData:
Automated Installation: Using UserData to manage software installation and updates ensures consistency and automation, which is beneficial for maintaining the environment in a repeatable manner.
Idempotency: Ensure the UserData script is idempotent, meaning it should handle re-runs gracefully (e.g., check if the software is already installed before attempting to reinstall).
Manual vs. Automated Updates: Automated Updates via UserData: This is useful for ensuring that every time the instance is recreated or updated via CloudFormation, it has the latest software version. This method is efficient but requires careful scripting.
Manual Updates: Manual updates give more control but lack automation and may lead to inconsistencies if multiple instances are involved.
Best Practice: For software like Power BI Gateway, it's generally better to automate the installation and updates via the UserData script in CloudFormation, ensuring the script is well-designed to handle re-runs and check the current software version before attempting any updates. This aligns with infrastructure-as-code principles
Relevant content
- asked 2 years ago
- asked 6 months ago