In this quick tutorial, we learnt about EC2 user data and how it can help us in bootstrapping our EC2 instance with required software and configurations.
Paste this user data as test as specified in above screenshot and move to next step. , in this screen only scroll down to Advanced Details section and provide user data script to install apache web server EC2 User data script to install Apache Web Server on Linux 2 #!/bin/bashĮcho “Hello World from $(hostname -f)” > /var/www/html/index.html When you are in step 5 and configuring instance details like VPC, subnet etc.
HOW TO INSTALL HTML EXECUTABLE HOW TO
Link : How to Launch EC2 Instance In AWS Step by StepĬomplete Step 1 to 4 as specified in the tutorial If you need help, you can use my previous tutorial to launch EC2 instance. Specify User Data while launching EC2 Instance Verify User data Execution/Apache Installation.Allow traffic on port 80 and 443 on Security Group.Specify user data while launching EC2 Instance.Note: User data scripts run as root user so you don’t need to specify sudo with your commands Steps to create EC2 User data You can specify below user data to achieve that.
You want to create a file log.txt in dev folder as soon as your instance starts. Rather all you need is to specify the whole script in the user data section and they get executed once your instance boots up. You don’t need to SSH into your EC2 instance and run those command one by one. These data/command executes after your EC2 instance starts. In a very simple terms if I say, user data is user data/commands that you can specify at the time of launching your instance. If you are a beginner and don’t know about ec2 user data script, here is a small section on the same. In this post, I will help you install the same apache web server but using EC2 user data script. You can use EC2 user data scripts to bootstrap your EC2 instance at launch. This is called bootstrapping your instance with required software and configurations. However, usually you would like your apache web server to be automatically installed as soon as your instance starts up. In one of my previous post, I explained how you can install apache web server in a EC2 instance.įor learning purpose that’s good. How to use EC2 User Data Script to Install Apache Web Serverĭear Reader, I hope you are doing good.