0% found this document useful (0 votes)
19 views11 pages

Get Started With Amazon EC2 Linux Instances

This document is a tutorial for launching and using an Amazon EC2 Linux instance, detailing the steps for instance configuration, including naming, selecting an Amazon Machine Image (AMI), and setting network and storage options. It guides users through the process of launching an instance, testing a web server, and terminating the instance to avoid charges. The tutorial emphasizes the importance of configuring parameters correctly and provides instructions for using a bootstrap script to install an Apache web server.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views11 pages

Get Started With Amazon EC2 Linux Instances

This document is a tutorial for launching and using an Amazon EC2 Linux instance, detailing the steps for instance configuration, including naming, selecting an Amazon Machine Image (AMI), and setting network and storage options. It guides users through the process of launching an instance, testing a web server, and terminating the instance to avoid charges. The tutorial emphasizes the importance of configuring parameters correctly and provides instructions for using a bootstrap script to install an Apache web server.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Get Started with Amazon EC2 Linux

Instances
Use this tutorial to get started with Amazon Elastic Compute Cloud (Amazon EC2). You'll learn
how to launch, connect to, and use an Amazon EC2 Linux instance. An instance is a virtual server
in the AWS Cloud. With Amazon EC2, you can set up and con gure the operating system and
applications that run on your instance.

In this hands-on, you will launch an instance using de ned parameters.You can accept any or all
of the defaults, or con gure an instance by specifying your own values for each parameter. The
parameters are grouped in the launch instance wizard. The following instructions take you through
each parameter group.

Parameters for instance con guration


• Initiate instance launch
• Name and tags
• Application and OS Images (Amazon Machine Image)
• Instance type
• Key pair (login)
• Network settings
• Con gure storage
• Advanced details
• Summary

Initiate instance launch


1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

Page 1 of 11
fi
fi
fi
fi
fi
2. In the navigation bar at the top of the screen, the current AWS Region is displayed (for
example, US East (N.Virginia)). Select a Region in which to launch the instance. This choice
is important because some Amazon EC2 resources can be shared between Regions, while
others can’t.

3. From the Amazon EC2 console dashboard, choose Launch instance.

Page 2 of 11
Name and tags
The instance name is a tag, where the key is Name, and the value is the name that you specify.
You can tag the instance, the volumes, and elastic graphics. For Spot Instances, you can tag the
Spot Instance request only.

4. Specifying an instance name and additional tags is optional.

• For Name, enter a descriptive name for the instance. If you don't specify a name, the
instance can be identi ed by its ID, which is automatically generated when you launch the
instance.
• To add additional tags, choose Add additional tags. Choose Add tag, and then enter a key
and value, and select the resource type to tag. Choose Add tag again for each additional
tag to add.

Application and OS Images (Amazon Machine Image)


An Amazon Machine Image (AMI) contains the information required to create an instance. For
example, an AMI might contain the software that's required to act as a web server, such as Linux,
Apache, and your website.

5. Under Application and OS Images (Amazon Machine Image), choose Quick Start, and then
choose the Amazon Linux 2 AMI (HVM) - Kernel 5.10, SSD Volume Type for your instance.

Page 3 of 11
fi
Instance type
The instance type de nes the hardware con guration and size of the instance. Larger instance
types have more CPU and memory.

6. For Instance type, select the instance type for the instance.

If your AWS account is less than 12 months old, you can use Amazon EC2 under the Free Tier by
selecting the t2.micro instance type (or the t3.micro instance type in Regions where t2.micro is
unavailable).

Compare instance types: You can compare di erent instance types by the following attributes:
number of vCPUs, architecture, amount of memory (GiB), amount of storage (GB), storage type,
and network performance.

Key pair (login)


7. For Key pair name, choose an existing key pair, or choose Create new key pair to create a
new one.

• For Name, enter a descriptive name for the key pair. Amazon EC2 associates the public key
with the name that you specify as the key name. A key name can include up to 255 ASCII
characters. It can’t include leading or trailing space

• For Key pair type, choose either RSA or ED25519.


• For Private key le format, choose the format in which to save the private key. To save the
private key in a format that can be used with OpenSSH, choose pem. To save the private key in
a format that can be used with PuTTY, choose ppk.

Page 4 of 11
fi
fi
fi
ff
• Choose Create key pair.

A. Enter a descriptive name.

B. For Key pair type, choose RSA.

C. For Private key file format,


choose either .pem or .ppk.

D. Choose Create key pair.

• The private key le is automatically downloaded by your browser. The base le name is the
name that you speci ed as the name of your key pair, and the le name extension is
determined by the le format that you chose. Save the private key le in a safe place.

Network settings
8. Con gure the networking settings as following:

• Network: Here the default VPC is selected automatically. You will be launching this EC2
instance in the same default VPC of the region you’re working in.

• Subnet: You can launch an instance in a subnet associated with an Availability Zone, Local
Zone, Wavelength Zone, or Outpost. For this hands-on, keep Subnet to No preference
(Default subnet in any availability zone).

Page 5 of 11
fi
fi
fi
fi
fi
fi
fi
• Auto-assign Public IP: Specify whether your instance receives a public IPv4 address. By
default, instances in a default subnet receive a public IPv4 address, and instances in a non-
default subnet don't. You can select Enable or Disable to override the subnet's default setting.
For this hands-on, keep Auto-assign public IP to Enable.

9. The launch instance wizard automatically de nes the launch-wizard-x security group and
creates an inbound rule to allow you to connect to your instance over SSH (port 22). Include the
inbound rules as following:

• To let the launch instance wizard add your computer's public IP address, choose My IP.
However, if you are connecting through an ISP or from behind your rewall without a static IP
address, you need to nd out the range of IP addresses used by client computers.

• Select Allow HTTPs tra c from the internet and Allow HTTP tra c from the internet rules
to allow internet tra c.

Con gure storage


10. The AMI you selected includes one or more volumes of storage, including the root volume. By
default, an 8 GiB of General Purpose SSD volume is attached to an Amazon Linux instance. For
this hands-on, accept default values.

Page 6 of 11
fi
ffi
fi
ffi
fi
ffi
fi
Advanced Details
11. For Advanced details, expand the section to view the elds and specify any additional
parameters for the instance.

• Accept all default parameters here except for User data. You can specify user data to con gure
an instance during launch, or to run a con guration script.

• Click here to download the bash script which will be used launch an Apache PHP web
application on this EC2 instance.

• Copy and paste the contents of the download script within User data eld.

Page 7 of 11
fi
fi
fi
fi
Summary
12. Use the Summary panel to specify the number of instances to launch, to review your instance
con guration, and to launch your instances.

• Keep all settings to default and choose Launch instance.

Review and test


After launching the instance, review and go through its details, and test the web server deployed
on it.

13. Click the Instance ID of the launched instance.

Page 8 of 11
fi
14. You will be straightaway sent to the Instances dashboard. Select the launched instance and
look for Public IPv4 address and Public IPv4 DNS within Details.

15. Now, access the website using either the public IPv4 address or public IPv4 DNS name and
you should get the following output.

Page 9 of 11
Terminate your instance
You can delete your instance when you no longer need it. This is referred to as terminating your
instance. As soon as the state of an instance changes to shutting-down or terminated, you
stop incurring charges for that instance.

16. Select the instance, and choose Instance state, Terminate instance.

17. Choose Terminate when prompted for con rmation.

Page 10 of 11
fi
After you terminate an instance, it remains visible in the console for a short while, and then the
entry is automatically deleted. You cannot delete the terminated instance entry yourself. After an
instance is terminated, resources such as tags and volumes are gradually disassociated from the
instance and may no longer be visible on the terminated instance after a short while

When an instance terminates, the data on any instance store volumes associated with that
instance is deleted.

Summary
This completes the hands-on exercise on launching of an Amazon EC2 Linux instance. You also
used a bootstrap script to install an Apache web server on it and later tested the website
successfully. After testing, the instance was terminated to clean up and avoid any unexpected
charges.

Page 11 of 11

You might also like