Use AWS EC2 Tags to Control a Linux Startup Script.

Introducing the Launch Tag concept.

Credit: undraw.co

For times when you want a Linux system to start up with adhoc functionality, use the EC2 Launch Tag concept to control how a service is started.

In a Linux start up script, fetch the AWS EC2 Instance Id and their respective Launch tag to determine how the script should behave on start up. For example, the start up behavior is determined by the EC2 Launch tag which can either be disabled on startup, put in a maintenance mode or started normally:

Start up Bash code snippet using an EC2 Launch Tag.

Say in this scenario, there is a standby Jenkins master which is primarily used in a high availability active-passive deployment. The standby master cannot be started normally because it would start scheduled jobs and compete with the active master. The EC2 Launch tag is set to “maintenance” which in the Jenkins start up script puts the application in “shutdown” mode, disabling builds from running. This allows the standby to be upgraded or tested for preparation of an imminent active role.

Hope you find the concept of an EC2 launch tag useful.

★★★★★

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store