How to create amazon EC2 window ?
- An EC2 instance is a virtual server in Amazon Web services terminology.
- It stands for Elastic Compute Cloud. It's an internet service where an AWS subscriber can request and provision a compute server in AWS cloud.
- An on-demand EC2 instance is an offering from AWS where the subscriber/user can rent the virtual server per hour and use it to deploy his/her own applications.
Login and access to AWS services
Step 1
- Open all the services and click on EC2 under Compute services.
All Aws Services
Aws Resources
Step 2
- On the top right corner of the EC2 dashboard, choose the AWS Region in which you want to provision the EC2 server.
EC2 Server
Step 3
- In this step Once your desired Region is selected, come back to the EC2 Dashboard.
- Click on 'Launch Instance' button in the section of Create Instance
EC2 Server
Choose AMI
Step 1
- Once you launch an EC2 instance from your preferred AMI, the instance will automatically be booted with the desired OS.
- Choose the default Amazon Linux (64 bit) AMI.
Choose AMI
Choose EC2 Instance Types
Step 1
- In the next step, choose the type of instance you require based on your business needs.
- Click on "Configure Instance Details" for further configurations
Choose an Instance Type
Read Also
Configure Instance
Step 1
- No. of Instances - You can provision up to 20 instances at a time. Here we are launching one instance.
Configure Instance
Step 2
- Under Purchasing Options, keep the option of 'Request Spot Instances' unchecked as of now.
Configure Instance Details
Step 3
- Next, we have to configure some basic networking details for our EC2 server.
- Network section will give a list of VPCs available in our platform.
- Select an already existing VPC
- You can also create a new VPC
- Select an already existing VPC to launch an instance
Configure Instance Network
Step 4
- A VPC consists of subnets, which are IP ranges that are separated for restricting access.
- Under Subnets, choose the subnet where you want to place your instance.
- Here is already existing public subnet.
- You can also create a new subnet in this step.
Configure Instance Subnet
Step 5
- Choose if you want AWS to assign it an IP automatically, or you want to do it manually later. You can enable/ disable 'Auto assign Public IP' feature here likewise.
- Here we are going to assign this instance a static IP called as EIP (Elastic IP) later. So we keep this feature disabled as of now.
Use Subnet Setting
Step 6
- Keep the option of IAM role 'None' as of now. We will visit the topic of IAM role in detail in IAM services.
IAM Role
Step 7
- In this step
- Shutdown Behavior - when accidently shut down your instance, you surely don't want it to be deleted but stopped.
- Here we are defining my shutdown behavior as Stop.
Shutdown Behaviour
Step 8
- In this step, In case you have accidently terminated your instance, AWS has a layer of security mechanism. It will not delete your instance if you have enabled accidental termination protection.
Enable Termination Protection
Step 9
- In this step,
- Under Monitoring - Enable Detailed Monitoring if your instance is a business critical instance. Here we have kept the option unchecked. AWS will always provide Basic monitoring on your instance free of cost.
- Under Tenancy - Select the option if shared tenancy. If the application is a highly secure application, then you should go for dedicated capacity. AWS provides both options.
Shared Hardware
Step 10
- In this step, Click on 'Add Storage' to add data volumes to your instance in next step.
Add Storage
Step 1
- In this step we do following things,
- In the Add Storage step, you'll see that the instance has been automatically provisioned a General Purpose SSD root volume of 8GB. You can change your volume size, add new volumes, change the volume type, etc.
- AWS provides 3 types of EBS volumes - Magnetic, General Purpose SSD, Provisioned IOPs.
Add Storage
Tag Instance
Step 1
- In this step
- This gives visibility to the AWS account administrator when there are lot number of instances.
- The instances should be tagged based on their department, environment like Dev/SIT/Prod. Etc. This gives a clear view of the costing on the instances under one common tag.
- Here we have tagged the instance as a Dev_Web server 01
- Go to configure Security Groups later
Tag Instance
Configure Security Groups
Step 1
- In this next step of configuring Security Groups, you can restrict traffic on your instance ports. This is an added firewall mechanism provided by AWS apart from your instance's OS firewall.
- Define open ports and IPs.
- Since the server is a webserver=, we will do following things
- Create a new Security Group
- Name the SG for easier reference
- Define protocols which we want enabled on my instance
- Assign IPs which are allowed to access our instance on the said protocols
- Once, the firewall rules are set- Review and launch
Configure Security Group
Review Instances
Step 1
- In this step, we will review all our choices and parameters and go ahead to launch our instance.
Review Instance Launch
Step 2
- In the next step you will be asked to create a key pair to login to you an instance. A key pair is a set of public-private keys.
- AWS stores the private key in the instance, and you are asked to download the private key.
- Create a new key pair
- Give a name to your key
- Download and save it in your secured folder
Create Existing Key Pair
- When you download your key, you can open and have a look at your RSA private key.
Dev Private Key
Step 3
- Once you are done downloading and saving your key, launch your instance.
Select Existing Key Pair
- You can see the launch status meanwhile.
Launch Status
- You can also see the launch log.
Launch Status
- Click on the 'Instances' option on the left pane where you can see the status of the instance as 'Pending' for a brief while.
Launch Instances
- Once the instance is up and running, you can see its status as 'Running' now.
- Note that the instance has received a Private IP from the pool of AWS.
Launch Instance Private IP
Create a EIP and connect to your instance
- An EIP is a static public IP provided by AWS. It stands for Elastic IP. Normally when you create an instance, it will receive a public IP from the AWS's pool automatically. If you stop/reboot your instance, this public IP will change- it'dynamic. In order for your application to have a static IP from where you can connect via public networks, you can use an EIP.
Step 1
- On the left pane of EC2 Dashboard, you can go to 'Elastic IPs' as shown below.
Elastic IPs
Step 2
- Allocate a new Elastic IP Address.
Allocate New Address
Step 3
- Allocate this IP to be used in a VPC scope.
Allocate New Address VPC
- Your request will succeed if you don't have 5 or more than 5 EIPs already in your account.
Allocate New Address in Close
- Now assign this IP to your instance.
- Select the said IP
- Click on Actions -> Associate Address
Associate Address- n Actions
Step 5
- In the next page, Search for your instance and Associate the IP to it.
Associate Address
Step 6
- Come back to your instances screen, you'll see that your instance has received your EIP.
Instances
Read Also
Step 7
- Now open putty from your programs list and add your same EIP in there as below.
Putty Config
Step 8
- In this step,
- Add your private key in putty for secure connection
- Go to Auth
- Add your private key in .ppk format. You will need to convert pem file from AWS to ppk using puttygen
- Once done click on "Open" button
Putty Auth
- Once you connect, you will successfully see the Linux prompt.
Amazon Linux
Create a Spot Request
- In order to launch a spot instance, you have to first create a Spot Request.
- Follow the steps below to create a Spot Request.
- On the EC2 Dashboard select 'Spot Requests' from the left pane under Instances.
- Click on the button 'Request Spot Instances" as shown below.
Spot Request
Find Instance Types
- The first step for spot instance is to "Find instance types."
Find Instance Types
Step 1
- Select an AMI - An AMI is a template consisting of the OS platform and software to be installed in the instance. Select your desired AMI from the existing list.
Spot Instance Launch Wizard
Step 2
- Capacity Unit - A Capacity Unit is your application requirement. You may decide to launch an instance based on the instance type, vCPU or custom configuration like your choice of vCPU/memory/storage requirements. Here we are selecting an Instance.
Find Instance Types Spot
- If you wish to customize the capacity, you can add your choice of
- vCPU,
- Memory and
- Instance storage as below.
Spot Instance Launch Wizard
Step 3
- Target Capacity depicts how many spot instances you wish to maintain in your request. Here we are selecting one.
Target Capacity
Step 4
- Bid Price - This is the maximum price we are ready to pay for the instance. We are going to set a particular price per instance/hour.
Bid Price
- Just below the bid price you can see a button of Pricing History. Click on that as shown below.
Pricing History
- Select the parameters and get an idea of the pricing of our desired instance over a period of time.
- Select the product. We have selected our Linux AMI.
- Select the instance type. We have selected m3.medium.
- Note the average prices for over a day here.
Linux Unix-m3 Medium
- Cont. to step 4. So let's come back to our step of quoting a bid price.
- For the sake of maintaining our instance always available and if it falls within our budget, we can quote a higher bid price. Here we have quoted a slightly higher price of $0.05.
Bid Price
- You can see some trends in the wizard itself.
- Note the instance types section
- Select the instance type that we are planning to provision
- Note the price that we are planning to bid. % of on-demand shows us that our quoted price is 75% of the on-demand price for the same instance type. This means we are saving 25% per hour as compared to an on-demand instance. You can further lower the price and save costs drastically.
Select Instance
Step 5
- Once we are done looking at the trends and quoting our bid price, click on next.
Select Instance
Configure the Spot instance
- Our next step is to configure the instance, in this step of the wizard, we'll configure instance parameters like VPC, subnets, etc.
Step 1
- Allocation Strategy - It determines how your spot request is fulfilled from the AWS's spot pools. There are two types of strategies:
- Diversified - Here, spot instances are balanced across all the spot pools
- Lowest price - Here, spot instances are launched from the pool which has lowest price offers
Spot Instance Launch in Lowest Price
Step 2
- Select the VPC - We'll select from the list of available VPCs that we have created earlier. We can also create a new VPC in this step.
Step 3
- Next we'll select the security group for the instance.
Web Server Sg
Step 4
- Availability Zone - We'll select the AZ where we want to place our instance based on our application architecture.
Availability Zones
Step 5
- Subnets - We are going to select the subnet from our list of already available list.
US East 1a
Step 6
- Public IP - We'll choose to assign the instance a public IP as soon as it launches.
Step 7
- Key pair - A key pair is a set of public-private keys.
Key Pair Name
Review your Spot instance
- Once we are done configuring our spot instance request in the 2 steps earlier in our wizard, we'll take a look at the overall configuration.
Json Config
- We can also download a JSON file with all the configurations. Below is our JSON file.
Config
- After we are done reviewing, we can proceed with the launching by clicking the Launch button as shown below.
Procees Launch
- Once we select Launch, we can see a notification about the request getting created.
Success
- The spot request creation wizard will close, and the page will automatically direct back to the EC2 Dashboard.
- You can see as shown below that the State of our request is 'open' which means that it is getting evaluated from the AWS's side. AWS EC2 will check if the required instance is available in its spot pool.
Request Spot Instances
- After a couple of minutes, you can see that the state is changed to 'active', and now our spot request is successfully fulfilled. You can note the configuration parameters below.
Request Spot Instances Active
If you want to learn about Cloud Computing Course , you can refer the following links Cloud Computing Training in Chennai , Big Data Training in Chennai.