AWS EC2 Tutorial for Beginners
This AWS EC2 tutorial will help you get started with Amazon Elastic Compute Cloud (Amazon EC2).AWS EC2 allows you to install and configure the operating system and programs that run on your instance.
What are AWS EC2?
AWS EC2, a compute service in the cloud, is a revolutionary solution for developers looking to scale up or down their infrastructure based on demand.
It offers secure and reliable compute capacity in the cloud, allowing developers to easily integrate with almost all Amazon services.
The best part is that users only pay for what they use just like your utility payments.
Major Components in AWS EC2:
Amazon Mission Image (AMI)
Private key
Security Groups (Firewalls)
Additional storage (EBS)
How to Create an EC2 Instance?
It begins with creation of Amazon Mission Image (AMI). AMI are used to create new instances based on your requirements, including software, operating system, additional applications & software information.
Configure the firewall for the EC2 instance, which allows or denies connection from the external world based on port number and IP address. Review the configurations and click on “Create” to launch an EC2 instance.
To launch an EC2 instance, users must review their configurations and click on the “launch” button. Before the Amazon console launches the instance, they can create a keeper, which is both public and private.
The private key is downloaded by the user and kept with them, while the public key is used by Amazon to confirm the user’s identity.
Additional storage options include permiral storage, external elastic block storage (EBS), or integrating EC2 with S3.
Free subscription users can use 30GB of SSD storage or magnetic storage for the whole year. Storage size, volume type, and encryption requirements are also provided.
Launch an AWS EC2 instance:
Browse for AWS EC2 console
Choose a Region, you can keep default or choose manually
Look for Launch panel in EC2 console dashboard & select Launch instance
Provide a name for your instance
Select an AMI image
Choose an Instance type
Create a private Key
Set the Network
Choose the storage option
Review the instance before launching the EC2 instance.
AWS EC2 Training
AWS Image Options:
The AWS marketplace offers various image options, including Windows, and allows users to choose the virtual hardware platform they want.
Amazon machine images come with third-party software, such as firewalls and load balancers, and community AMIs are shared for public use.
Users can filter by operating systems and select an instance type to get the correct virtual hardware configuration. The console may look slightly different on the screen due to AWS changes over time.
EC2 Instances:
EC2 offers various options for launching instances, including on-demand instances, reserved instances, spot requests, and savings plans. On-demand instances are flexible and can be terminated anytime.
Reserved instances allow users to reserve capacity for specific periods, such as 12 months or 36 months, with a 75% discount.
Spot requests purchase spare capacity at a discounted rate, but the capacity may be shut down when the full rate is paid.
Route tables in EC2 management console:
The route table in the EC2 management console allows for internet access and the assignment of public IP addresses to instances. Public subnets are configured to automatically provide public IP addresses to any instances launched into them.
Keypads:
Keypads are crucial for accessing Linux AMIs and Windows AMIs. They consist of a public key and a private key file, which are stored by AWS.
To create a new key pair, create a new account and download the key pair. To ensure security, create a new key pair and launch instances.
How to connect a Linux Instance?
To connect to a Linux instance from a Windows machine, go to putty.org and install it.
Use the putty key generator to modify the PEM file and generate a PPCA file.
Load the file, select all files, select your file, open, click OK, and save private key. Close the file and choose putty.
Copy the IP address to the EC2 management console and type EC2-user. Load the PPCA file and open the session.
Give the session a name, call it my EC2-instance, and select open.
This connects us to our Amazon Linux instance running in from a Windows instance.
AWS EC2 Security Groups:
security groups, which are firewalls applied at the instance level. They look for traffic going into and out of elastic interfaces connected to the instance.
To launch two instances, navigate to the AWS Management Console and select launch instance. Choose Amazon Linux 2 AMI and T2 micro, and set up two instances in the default VPC. Choose the security group as web access and secure shell into the instances.
To ping from one instance to another, copy the IP address to the clipboard of one instance and secure shell into the second instance. The private IP address can be obtained from the console or in the text before the command line.
AWS EC2 Online Training
Command URL:
The command “URL” (169.254/latest/meta dash data) will provide various categories of information about the instance. By drilling down further, we can get the hostname, public, local, and network information.
Public IP addresses (IP) and Elastic IP addresses in AWS EC2:
Both are public IP addresses, meaning they are publicly routable on the internet.
However, the key difference is that the elastic IP address is static, meaning it can be moved between instances and elastic network adapters. Elastic network adapters are additional interfaces that can be attached to an instance.
To create an elastic IP address and associate it with an instance, go to elastic IPs under network and security and choose allocate new address. This will create a static public IP address that is associated with the instance.
If the instance closes, it is not going anywhere. To associate the new IP address with the instance, choose actions associated address and choose an easy to instance or a network interface.
When attempting to associate the new IP address with the existing public IP address, it warns that the current public address is released, and the new elastic or static address is assigned.
To associate the new IP address with the instance, choose the “associate” option and choose “learn more.” This will ensure that the new IP address is assigned to the instance and not to the existing public IP address.
Public IP addresses are free and used in public subnets, while elastic IP addresses are charged if not used.
For example, an elastic IP address may be allocated to an account but not associated with an instance or an elastic network adapter. In these cases, a small charge may be charged to incentivize use of these addresses due to the shortened IPv4 addresses on the internet.
Public IP addresses are always associated with a private IP address on the instance. The internet gateway performs one-to-one net, changing the source address from the operating system to the public IP address.
The internet gateway’s job is to change the source address to a public address and send it out to the internet, allowing it to be addressed and routable on the internet.
NAT instances:
NAT instances are managed by AWS and can be provisioned into your availability zone or subnet. The easy-to instance in private subnets are pointed to the NAT gateway through the route table.
The route table for a private subnet does not have an internet gateway, but in this case, it has a NAT gateway ID. The route to the outside world is peer-dressed range, and anything that isn’t within this range will be routed by the NAT gateway.
NAT instances can be used as a bastion host or a public IP with a NAT gateway. You can choose an elastic IP or a public IP with a NAT gateway.
One potential advantage of a NAT instance is that you can implement port forwarding through manual customization.
AWS Clusters & Placement Groups:
AWS clusters and partition placement groups provide various benefits for high performance computing and enhanced networking.
Clusters are used to place instances into low latency groups within a single A-Z, resulting in low network latency and high throughput. They can be created using an enhanced network adapter (ENA) or partition placement group.
These partitions are located on separate AWS racks, providing a layer of resiliency due to their own power sources and backup power sources.
Spread placement groups are also used, with each instance located in a separate rack. This provides resiliency as each rack has its own redundant power networking.
Different types of placement groups, such as clustered, partition, and spread placement groups are available.
AWS EC2 Course Price
G. Madhavi
Author
The capacity to learn is a gift the ability to learn is a skill the willingness to learn is a choice