Showing posts with label AWS. Show all posts
Showing posts with label AWS. Show all posts

Monday, 12 October 2020

EC2 Dedicated host

 * You reserve an entire host on AWS cloud and you launch EC2 instances directly on it.

* it can help in a BYOL(bring your Own license) model or when you have strong regulatory, compliance or security requirements.

* it's overall more expensive and should not use it unless strongly required. you can also reserve dedicated hosts.


Hands for launching dedicated host:

Navigate to instances --> Dedicated Hosts


Click on Allocate a host, as shown below.                                                                                               


provide details:

  1. choose instance type for dedicated host.
  2. Available zone for the dedicated host.
  3. allow instance auto-placement - basically an auto scale of dedicated EC2 instance option.
  4. quality of dedicated EC2 instance.
  5. finally click on Allocate host as highlighted below.



Spot instance

 AWS EC2 spot instances  are using the spare capacity in AWS cloud and provide you EC2 instance at individual requested price.

 At any point of time,AWS can reclaim(terminate ) your instance to the highest bidder with 2 minutes of notification.

you can use AWS EC2 spot instance for machine critical appications.

Do not run critical jobs on EC2 if you can't tolerate failure!.


Hands on:

from the EC2 instance launch page, Navigate to instances --> Spot Requests from the left menu.


Click on Request spot instances.                                                                                                                     

Then the screen prompts to screen where we need to provide all the inputs for spot instance. provide all your inputs based on your requirements.

Finally click on launch.  










Friday, 9 October 2020

EC2 Reserved instances in AWS

 Amazon EC2 Reserved instances(RI)  provides a significant discount( up to 75%) compared to On-Demand pricing and provide a capacity reservation when used in a specific Availability Zone.

discount when you use an EC2 for a long continue use.


You have the flexibility to change families, OS types, and tenancies while benefitting from RI pricing when you use convertible reserve instance (up to 54% discount)

Scheduled RI: reserve  during specific launch periods. For example if you are able to predit demand during the day this is a great option.

Summary: you know you'll need an EC2 instance for a year you should consider using reserved instances.


 




Payment option: You can choose between three payment options:                                                             
1. All upfront:  You pay for the entire Reserved Instance term (one or three years) with one upfront payment and get the best effective hourly price when compared to On-Demand.                                                                                                
2. partial upfront: you pay little bit and rest is installments.                                                               
3. No Upfront: all monthly installments which makes little expensive.                                          
you choose the partial or No Upfront payment option, the remaining balance will be due in monthly increments over the term.



Hands on:                                                                                                                                                                         
Step1: create an EC2 instance in a standard on -demand process.  (ex: suppose T2 instance here)                                                            
 Step2: Purchase a reserved instance. that matches the EC2 instance create in the step1. (T2 instance here too).
                                                                            

*Automatically the billing for the T2 type instance will goes to reserved instance.     


step3: in case of additional changes in the step1. suppose from T2 type instance to C4 type instance.
Step 4: launch the C4 type instance for reserve instance.                                                                         

*Automatically the billing for the C4 type instance will goes to reserved instance.     

Navigate to instance --> Reserved instances as shown below.                                                                                       


Click on purchase reserve instances.                                                                                                         



Choose your platform                                                                                                                                    


Tenancy :                                                                                                                                               
Default option:    for sharing with other people. when you are not using the reserved instance host.
Dedicated: only for you.                                                                                                                       

Offering Class : As per above table in this post.                                                                                            

Provide instance type and duration for the reserved instance info.                                                                             

Choose your payment option.                                                                                                                                   
Click on search.
Add the desired quantity, suppose you need same C4 type instance - 4 no. you can provide you entry as 4 here.
Click on Add to cart.
Finally click on view cart and pay the price.



Friday, 2 October 2020

Creating new EBS volume

 This post will help you to  create new EBS volumes in AWS.


Practical steps:


From the EC2 launch page navigate to volumes.                                                                                                      



Click on create volumes



Provide details:

1.from the volume type dropdown, select the required volume type.
2.provide size of the volume in GB
 
    based on the size the volume, the iops value will changes.
    suppose for 2GB - min/max iops is 100/3000
    if size of volume is 200GB, then min/max value will be 600/45000


---------------------------------------------------------------------------------------
if the requirement is to create a EBS volume to attach to one specific EC2 instance.
check the Availability zone information here. from running EC2 instance page.









-----------------------------------------------------------------------------------------------------
Enable encryption if really required.
tags are optional.
click on Create volume 


Volume created successfully.                                                                                                                                          
                                                                                                                   



EBS volume intro

 EBS Volume: it's a network drive(i.e not a physical drive)

  • It uses the network to communicate the instance, which means there might be a bit of latency.
  • it can be detached from an EC2 instance and attached to another one quickly.
it's locked to an Availability Zone(AZ)

  • An EBS volume in US-east-1 a cannot be attached to US- east 1b
  • To move a volume across, you first need to snapshot it.


Thursday, 1 October 2020

Application load balancer

with  Application load balancer can do the following:

  • Load balancing to multiple HTTP applications across machines (target groups)
  • Load balancing to multiple applications on the same machine(ex: containers)
  • Load balancer based on route in URL.
  • Load balancer based on hostname in URL.
in comparison, we would need to create one Classic load balancer per application before. That was very expensive and inefficient.



Target group represent one application included with some EC2 instances along with health check. we will register the target group to Application load balancer.

in the below flowchart, we have 2 target group with representation of 2 application, registered to application load balancer with the protocol HTTP.


if the user searches for route/user, then the application load balancer redirected it to target group users. Similarly for search target group also,if the user search for route/search, our Application load balancer will re-direct it to search target group.




in this post, we will do hands on for:

  • Create a target group.
  • Setup an application load balancer.
practical steps for Create a target group :

---------------------------------------------------------------------------------------------------------------------------
from load balancer page --> Navigate to load balancer --> target groups(as shown below).




Click on Create target group.


Provide details:
1. enter target group name:                                                                           
2.enterprotocol for EC2 instance connection from target group.         
3.port no. for HTTP protocol is 4567.                                         
4.VPC: i'm give default one.                                                

Health check settings:                                                                                           
protocol as HTTP                                                                            
path = /health                                                                                  

Click on the Advanced health check settings dropdown.                                                                              provide the override port (ex: port no.4568) if required.                                                    
provide time interval info.                                                                                                 
finally click on create. 

conformation screen for target group creation.                                                                                                  





Then screen will prompts to target group page, Navigate to Targets tab --> Edit.

Then the screen goes to Register and deregister targets page. 
1.Ensure that the port number is 4567 based on protocol.                                          
2.select the required EC2 instance that need to add target group.                              
                 3.click on Add to registered.                                                                                                      4.Finally click on SAVE option available at the right bottom of the page.               
                                    


Now both the EC2 instances are available now in the targets group tab. but the status of EC2 instance will be unused until load balancer assigned to target group.



-----------------------------------------------------------------------------------------------------------------------------

  • practical steps for Setup an application load balancer:


Now navigate to load balancer page:


Click on create load balancer.



Choose application load balancer--> Click on Create.


provide details for the load balancer:

Name : <load balancer name>
scheme: internet facing - public ip based load balancer( web)
by default load balancer HTTP protocol and load balancer port as 80 is available.



here i am selecting all the availability zones and click on Next.


can add other protocol waring screen will appears in the next step. can ignore and click on next.
if any other protocol is required add them in the last step & Now click on Next.




Add security Groups to the load balancer.


Configure routing: 

choose Target group as Existing target group.
Name : dropdown select the correct load balancer.

rest all information will be updated based on this 2 entries.

Click on Next.



Conform the target groups and click on Next.


Review all the inputs and click on create.




Now change security groups, so that application load balancer will access the EC2 instances.







That's all similarly we can add multiple target groups to single Application load balancer.



-----------------------------------------------------------------------------------------------------------------------------

Sunday, 27 September 2020

Classic load balancer

 Even though it is old version of load balancer many AWS users are still using these one.


From EC2 instance launch page, Navigate to load balancer option.




Click on Create Load Balancer.

Click on create for Classic load balancer

 

Then the below screen will prompts.
Provide details:

from the below screen shot:

1.Load Balancer name: <just description for the load balancer>
2. Provide VPC details: here i am selecting default VPC.
3. Create an internal load balancer - if the check box is enable the load balancer will work for the private network. Vice versa disable the check box to make load balancer for public network.  
4.Enable advanced VPC configuration: is to configure load balance for subnet VPC.
5. Add button: To enable ports for new protocol.
6.Portion 6 in the below screen: for load balancer protocol and respective port number.
7. Portion 7 in the below screen: is protocol and port number of EC2 instance.

Assign security groups:

1. in between Create a new security group and select an existing security group options, select based on you own requirement.

if No security group are available, select create a new security group option.

2.provide security group name and description for the security group.
3.provide protocol info, by clicking on the Add rule button.

Click on Next 



3. Configure security settings: improve your load balancer's security, by using either HTTPS or the SSL protocol for your front-end connection.



Configure Health Check: 

your load balancer will automatically perform health checks on your EC2 instances and only route traffic to instances that pass the health check. if an instance fails the health check, it is automatically removed from the load balancer. customize the health check to meet your specific needs.



Add EC2 instances:

The table below lists all your running EC2 instances. Check the boxes in the select column to add those instances to this load balancer. 

1. Select the required EC2 instance for load balancing to load balancer.

2.Enable cross Zone load balancing: if the EC2 instances are available in 2 Availability zone, then need to enable this check box.

Enable connection Draining: connection health check for the EC2 instances if the EC2 instance is not connect to load balancer with in 300 seconds. then the load balancer will treat EC2 is unhealthy.

Finally check on Next.


Add tags:

tags are used for better description of EC2 instances.
Add tags based on your own requirements.

Here i'm not adding any tags. Click on Next.

Review:

review all the parameters provided for the creation of load balancer so far. Finally Click on Create.



Conformation screen looks like below, Click on the load balancer name as shown below. 
DNS name can obtain here: with this DNS name can access application.





Copy the DNS name and paste in browser to check load balancing