- Go to https://aws.amazon.com/free/ and follow instrucitons to sign up to AWS. (Debit/Credit card required)
- Go to EC2 page in AWS. https://console.aws.amazon.com/ec2/v2/home
- Click 'Launch Instance'
- Select 'Amazon Linux 2 AMI (HVM), SSD Volume Type' AMI
- Select 't2.micro' as Instance type and click 'Next: Configure Instance Details'
- While leaving rest of configurations default on the 'Configure Instance Details' page, scroll to the bottom of the page and expand 'Additional Details'.
- Copy the following snipet of code in the 'User data' text box:
#!/bin/sh
yum install -y git
git clone https://github.com/umair-io/bootstrap_ec2.git
find /bootstrap_ec2/ -type f -iname "*.sh" -exec chmod +x {} \;
/bootstrap_ec2/main.sh
7. Keep click 'Next: ...' (bottom of the page) until you get to 'Configure Security Group' page. 8. Select 'Create a new security group' and add a 'HTTP' rule (using the drop down list). Following that click 'Review and Launch' 9. When prompted to Create a new key pair, select 'Create a new key pair' from the drop down list, type the key name of your choice and click 'Download Key Pair'. 10. After saving the key pair, click 'Launch Instances'.
- Go to EC2 page in AWS and click 'Running Instances' link. You should now see the EC2 instance you created earlier. https://console.aws.amazon.com/ec2/v2/home
- Select the instance row and get instance's 'IPv4 Public IP' under the 'Description' tab.
- Now in your browser, go to http://[IPv4 Public IP]/
- You should now see your webserver.
- To make changes, fork this repo 'bootstrap_ec2'.
- Change to bootstrap script to point to your forked repo i.e.
git clone https://github.com/[YOUR_GIT_USERNAME]/bootstrap_ec2.git
- Make and commit changes to .html files in
html_files
folder in the git repo e.g. change to index.html - Create an EC2 instance with your new bootstrap script (now pointing to forked repo in your git)
- Open the terminal on your laptop.
- CD to the dir where you downloaded your key-pair.
- Change privs on the key-pair file.
chmod 400 FILE.pem
- ssh -l ec2-user IPV4_address -i key-pair.pem