AWS EC2 Free Tier: How to Install AWS EC2 For Free
AWS EC2: Amazon Web Services (AWS) is an Amazon.com cloud computing service. AWS provides its customers with access to virtual servers, storage space, databases, networking tools, and other resources.
AWS offers several types of instances, each designed for specific tasks. The most common instance type is the general purpose t1.micro, which has 2 GB of memory and runs at 0.5 GHz. This instance type is perfect for running simple applications or websites.
You can create your own custom AMI image from scratch using the AWS console. Once you’ve created your AMI, you can launch an instance from it. You can also download pre-built images from AWS Marketplace.
Install Go on AWS EC2:
AWS EC2 is Amazon’s cloud computing service that provides virtual servers to users. You can use it to host websites, run applications, and store data. If you want to install Go on AWS EC2, follow these steps:
a. b. Click the “Launch Instance” button.
c. On the “Select AMI” page, choose Ubuntu 16.04 LTS (HVM) – ami-0d8f9e65.
d. Choose the instance type.
e. Enter the name of the instance.
f. Select the region where you want to launch the instance.
g. Click “Create Launch”.
h. Wait until the instance launches.
i. Once the instance is launched, click the link in the email sent to you by Amazon.
j. Log in to the instance using SSH.
k. Run sudo apt update
to download updates.
l. Run sudo apt upgrade
.
Create an AMI from your local machine:
- 2. Open the AMI file using any text editor (Notepad++, Sublime Text)
- Find the line starting with ! /bin/bash
- Change the first line to read: !/usr/bin/env bash
- Save the file
- Select ‘Open with…’ from the context menu when you right-click the file.
- Select ‘Set as default application’
- Click OK
- To launch the file, double-click it.
- You should now have a working AMI file
- If you want to create a new AMI file, simply repeat steps 1 – 10
Launch an instance with the AMI:
AMI stands for Amazon Machine Image. You can launch an instance with AMI using the following command line:
The above command launches an instance with the AMIs image id `amit-0f9b86fa9c0e6ba99f8f3d69f9db9a`. If you want to change the image id, use the following command:
aws ec2 run-instancesto modify-image-attribute –image-id amit-0f9bea09c0e6ba9f8f3dd9f9db9a`` You can find the AMI ID of any AMI by running the following command:
aws ec2 describe-images –filters Name description,Valuesami-*`
This command returns the AMI ID of the AMI.
Configure your instance to use port 8080:
- Open your terminal and run
sudo nano /etc/default/tomcat8
- Insert this line into the file:
- JAVA_OPTS”-Djava.net.preferIPv4Stacktrue -Xms256m -Xmx512m -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction75 -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio16 -XX:MaxTenuringThreshold15 -XX:TargetSurvivorRatioPct90 -XX:+DisableExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath/var/lib/tomcat8/hsperfdata/dump.hprof”
- Close the editor and save the file. Run
sudo service tomcat8 restart
Conclusion:
Installing Go on AWS EC2 is a great way to start using Go on EC2. You can also use this method to install other languages like Python, Ruby, Java, etc.