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. In the AWS Management Console search bar, enter EC2, and click the EC2 result under Services:
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
- Launch 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 the Launch instance drop-down and click Launch instance:
You will be directed to the Launch an instance wizard.
4. In the Name and tags section, an optional name can be added that will create a tag that will have the key of Name. Additional tags can also be created here.
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.
5. In the Application and OS Images section, select the Amazon Linux option under Quick Start:
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.
6. In the Instance Type section, 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, memory, and pricing).
7. In the Key pair section, click on Create new key pair, enter keypair for the Key pair name, keep the default value for Key pair type and Private key file format, and click Create key pair. The key pair will begin downloading 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.
8. In the Network settings section, read the supporting text under Security groups (Firewall), and ensure the Allow SSH traffic from box is checked and Anywhere is selected:
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.
9. In the Configure storage section, ensure the default values of 8 GiB and gp2 Root volume is selected:
The default values work fine here. 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.
10. Click on Advanced details to expand the section and take a minute to look over the various configurations:
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
11. Review the Summary section, and click Launch instance when ready:
A confirmation page will let you know that your instance is launching:
12. Click the View all instances (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:
Warning: If you see the error compute-optimizer:GetEnrollmentStatus, just ignore it, it doesn't prevent the lab from working.
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 Credentials 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