Understand Pricing
- Amazon Web Services (AWS) offers a range of cloud computing services.
- For each service, you pay for exactly the amount of resources you actually need.
- To Know pricing details, click here.
- For learning purposes, we go through on-demand pricing.
- EC2 is CPU, Memory, and storage.
- Based on what you want to do with EC2 in AWS, the price varies.
- It’s better to choose the free version of Linux instead of Enterprise Linux.
- Once you create the cluster, if you use it or not, charges are applicable on an hourly basis.
- To check the pricing, click here.
E.g.: If we want to build 6 nodes and spend 300 hours of running over a period of 2 months. For 6 instances, total hours will be 1800 hours. If we take m4.Large machines with vanilla Linux configuration which 10 cents as per below image. So the cost will be 1800 * 0.10 = $180 for EC2 machines. If we run the cluster 24 hours in the 2 months (60 days) it will cost us $864 for 1440 (60 * 24) hours.
In the next video, we will see how to create or connect ec2 instance for our requirement.
Create your first EC2 Instance
- Login AWS console
- Understand the which region you are.
- Search or choose EC2 from the services
- Click on the launch instance to create ec2 instance
- Choose an Amazon machine Image(AMI)–You can choose Free Tier or Enterprise based Linux EC2 instance, as per your requirement.
- Search on AWS marketplace (E.g: Centos)
- Choose an Instance Type (CPU and Memory)
- Select your instance type, and click next.
- E.g: General Purpose (t2.large), Compute Optimizes (c5.large) etc.
- Based on the instance type, machine CPU, memory and storage will be configured for the machine.
- Configure Instance details (Networking)
- Two important things for server on top of memory and cpu is networking and storage.
- Choose number of instances that you want to launch and network (default VPC created by amazon).
- You will get your own VPC (Virtual Private Cloud Name) within ec2 machines
- Add Storage
- By default, will get 8 GB as part if free tier storage, change the size according to your requirement
- Choose volume type – Magnetic or SSD
- Add tags
- Just for your reference, generally Name key will be added.
- E.g.: Key: Name – Value: centos7freetier
- Configure Security Group or Firewall
- Choose Create a new security group
- Enter Security Group Name (E.g:centos7freetierdemo)
- Only SSH is made available to connect to the system remotely.
- Review
- If you want to do any changes , you can change any configuration of your machine at this step based on suggestions or requirement.
- Launch the Instance
- Whenever we provision machine, it will ask you create new keypair.
- Important to connect the machine, Give the name (E.g: freetierdemo)
- Download the key pair with .pem extension (Only at this step you can download this file)
- And then click on Launch instance.
Note: Understand cost associated with each instance before provisioning any instance.
Connecting to EC2 Instance
- Go to AWS Management Console, Choose the instance you want to connect, make sure it is running without any issues and click connect which prompts a window asking Open any available SSH Client.
- In this video, we will be connecting to the instance using the Cygwin (SSH client) which we configured in the previous step.
- Copy the key pair and paste it in C:\Cygwin\home\username
- Open the Cygwin, change the permissions as per instructions.
chmod 400 filename.pem
- Use the given command or below sample command to connect the instance.
ssh -i “filename.pem” username@Public-DNS-name
- You should be access the instance command shell, and validate the configuration by the below sample commands.
hostname -f : To check the hostname of the machione
df -h: To check the storage details
Cat /etc/redhat-release : To check the OS information