Advertisement

Wednesday, August 28, 2019

Amazon Web Services (AWS) : EC2-User Data

EC2 - user data is one of the seldom used features, yet a powerful feature. 
It is basically a simple script which can is executed at boot time by the system, the script has sudo 

It can be used for - 
• Installing updates
• Installing software
• Downloading common files from the internet

• Anything you can think of

It is configured in Advanced section of the Instance Launch Page. 

Below is an example of apache Service install and launch using an ec2-script. 

#!/bin/bash yum update -y
yum install -y httpd.x86_64
systemctl start httpd.service
systemctl enable httpd.service

echo "Heloo World" > /var/www/html/index.html/index.html


The greatest of the use of EC2-user data is when using load balancing, starting parallel instances and any boot time action you want to perform (manually or automatically).

Remember - the header #!/bin/bash is mandatory and without it your script will not work. 

2 comments:
Write comments
  1. In order to gain full advantage of AWS Optimization true potential, businesses must first understand and appreciate the complexity of their current workload and associated cost structures.

    ReplyDelete
  2. Not only does AWS have extensive technical documentation on their website, but they have an excellent support team that will be able to help you no matter what issues may come up. You are curious to know more about cloud cost optimization, click here.

    ReplyDelete