Creating an EC2 Instance
In this Lab Step, you will use the AWS Management Console to create, configure, and launch a Linux EC2 instance.
1. Select Services > EC2 from the AWS Management Console home page:
You are placed in the EC2 Dashboard.
2. Since this may be your first exposure to the EC2 Dashboard, it's worth spending a minute or two learning a few important parts of the dashboard:
From left to right, top to bottom:
- Additional navigation options are across the top-left of the Dashboard
- Basic account information, current region, and Support options are across the top-right
- Navigation to additional EC2 resources and features are located in the left pane
- Resources section - provides a high-level summary of current EC2 resource usage
- Create Instance section - Offers a single click to start the process of launching a new EC2 instance (you'll do that next)
- Service Health section - Simple and quick way to obtain the high-level service health in your region (or click Service Health Dashboard for a more comprehensive AWS health check)
- Additional Information - Context sensitive help on Getting Started (with EC2) or a complete listing of all AWS documentation
3. Click Launch Instance.
A seven-step wizard is started. That may sound like a lot, but don't worry... the instructions will guide you through the basics for each step.
4. Click the top Select button to choose the Amazon Linux 2 AMI (Amazon Machine Image):
As you can see, Amazon provides many AMIs, including the most popular versions of Linux and Windows, often in 32-bit and 64-bit variants. Look at the supporting text to find out what other software packages and development languages are already installed on the image (such as Perl, Python, Java, etc.). You can think of AMIs as the blueprint or DNA of the instance you plan to launch.
5. On the Choose an Instance Type page, you should not change any options. Simply make sure the default t2.micro is selected:
For whatever Instance Type is selected, the Currently selected list provides a helpful summary of hardware resources (such as the CPU type, number of virtual CPUs, and memory).
6. Click Next: Configure Instance Details when ready to continue.
Tip: There are Previous and Next buttons in the wizard for additional navigation options as you configure your instance.
Take a minute to look over the Configure Instance Details page:
You can configure many different options on this page of the wizard, but it's best to keep your first launch simple. Skim the different fields, but leave the default values. If you are particularly interested in any particular field, hover over the i information icon next to it for a basic description. The information icon is a useful feature for easing your learning curve while using the AWS Console. In many cases, the help text also includes a link to related documentation. To summarize a few key points:
- You will launch a single instance
- The Cloud Academy Lab environment has created a default VPC (Virtual Private Cloud) for you to launch your instance into
- The EC2 service will launch the instance into one of several subnets in the US West (Oregon) region
7. Click Next: Add Storage.
The Add Storage page enables you to further configure storage options:
The default values work fine here too. There is no need to add additional volumes, encrypt volumes, or change any other settings. Simply note this is where you can change storage settings if needed.
8. Click Next: Add Tags when ready.
The Add Tags page provides a helpful way to organize your EC2 instances:
Tags are specified as Key/Value pairs. They are not mandatory although it is useful to tag all of your AWS resources in production environments to stay organized. You can leave the tags empty for this Lab.
9. Click Next: Configure Security Group when ready.
Read the supporting text near the top of the Configure Security Group page of the wizard:
The Warning from AWS is letting you know the default configuration for the security group that is about to be created will grant SSH access from any source IP address (0.0.0.0/0). Production environments should be more restrictive. For the purposes of this Lab, this configuration is fine.
Tip: A handy feature for testing purposes is to select My IP from the Source drop-down. That will restrict SSH access to only your current IP address. In network environments with Dynamic Host Configuration Protocol (DHCP), multiple routers or firewalls, and other features that make IP addresses subject to change, this setting is not a permanent security feature. However, it is sometimes a helpful feature while you perform various tests using your EC2 instance.
10. Click Review and Launch when ready.
Spend a few minutes expanding/collapsing the various sections on the Review Instance Launch page of the wizard:
Be sure to look over the Instance Type, Instance Details and Storage sections. You do not need to change any of these settings at this point, but it's helpful to learn the type of information and configuration options available.
11. Click Launch when ready.
12. In the Select an existing key pair or create a new key pair dialog box, select Create a new key pair. Enter keypair for the Key pair name and then click Download Key Pair:
The download will create a file named keypair.pem on your local system. It contains a private key that you can use to connect to the EC2 instance via SSH.
13. Click Launch Instances. A confirmation page will let you know that your instance is launching.
14. Click the View Instances button (lower right) to close the confirmation page and return to the Instances screen of the EC2 console.
You can view the status of your instance on the Instances screen of the EC2 console:
The Details tab contains a wealth of information on your instance. When you launch an instance, its initial Instance state defaults to Pending. After the instance starts, its Instance state transitions to Running, and it receives a Public IPv4 address and Public IPv4 DNS name. It typically takes about 30 seconds for the AWS Linux instance to transition to a running state.
Congratulations...you just launched your first EC2 instance!
In this Lab Step, you launched an EC2 instance. You learned key areas of configuration for your EC2 instance using the Launch Instance wizard. Although many configuration options were left at their default values, you should have a pretty good understanding of the type of configuration options available to you within the wizard. Now that you have a running instance, you can treat it as any other Linux host. That is, you can connect to it, install and configure software, develop applications, and other tasks.
Note: In this Lab Step you learned how to generate your own SSH key pair for connecting to a running Linux instance. It is important to learn the mechanics behind accomplishing this. However, the Cloud Academy lab engine generates both a PEM and PPK formatted key pair. It is made available to you for the sake of convenience in the Your lab data section of the Cloud Academy lab window. This is where you initially copied your random student account password used for signing into the AWS console. In other Labs, you may be directed to use an existing key (the one generated for you), not create your own key prior to launching an instance.
Check if the Amazon EC2 instance has been created