> ## Documentation Index
> Fetch the complete documentation index at: https://cloud-architect.ipoint-labs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an AWS EC2 Instance and run some AWS CLI Commands Challenge - CLI Automation

> Hands-on lab · 30m

Launch this lab in the IP Lab Portal, then follow the steps below in the AWS console.

<a className="ip-lab-portal-btn" href="https://labs.intellectualpoint.com/labs/create-an-aws-ec2-instance-and-run-some-aws-cli-commands-challenge-cli-automatio" target="_blank" rel="noreferrer">
  Open IP Lab Portal
</a>

## Overview

### Prerequisites

1. Good Knowledge of AWS services
2. **AMAZON EC2**
3. **AMAZON CLI**
4. Laptop/Desktop
5. Internet Browser
6. Good Internet Connection

### Challenge Instructions

1. **Region:** Make sure to use **us-east-1 region** to create all the resources.
2. You will be provided with the requirements of the challenge.
3. If you are new to AWS Cloud, we recommend you go through our hands-on Labs before taking this challenge.
4. Challenge Duration: **90 minutes**.

### How to Submit Labs

1. After building the infrastructure, click on the **Check my work** button, to validate if you have built the required infrastructure and completed the challenge successfully.
2. **Validation status:**

   * **Success** - You have completed the challenge successfully.
   * **Failed** - You have failed to complete the challenge.
3. Once you have successfully validated the challenge, click on **End lab** button to end the challenge.

### Launching Challenge Environment

1. Click **Launch lab** in the IP Lab Portal.
2. To launch the challenge environment, Click on the **Launch lab** button.
3. Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
4. Once the Challenge is started, you will be provided with **IAM user-name, Password, Access Key,** and **Secret Access Key**.

<Note>
  You can only start one challenge at any given time.
</Note>

## Lab guide

### Sign in to AWS Management Console

1. Click **Open console** to launch the AWS Management Console in a new browser tab.
2. On the login page:

   * Retain the default **Account ID** (12-digit number; do not edit).
   * Input the provided **IAM Username and Password**.
   * Click **Sign In**.
3. In the Console, select **us-east-1 (N. Virginia)** from the top-right region dropdown.

### Architecture

### Cloud Challenge Details

XYZ Company wants to manage its servers using command-line tools for faster setup and automation. Your job is to launch an EC2 instance, connect to it, use AWS CLI to create a key pair, security group, and another EC2 instance, view the new instance, validate, and terminate it. AWS CLI lets you control AWS resources from a terminal. Here’s how to do it with key steps and hints:

* **Launch an EC2 instance:**

  * AMI: **Amazon Linux 2023**
  * Instance type: **t2.micro**,
  * create security group with SSH (port 22).
  * Attach the IAM pre-configured IAM Role to EC2.
* **SSH into the EC2 Instance:**

  * Create a keypair in us-east-1  using AWS CLI
  * **Create a Security group with port22 using CLI inside EC2:**
  * **Launch an EC2 Instance with AMI AMAZON LINUX 2023  using CLI**

    * Instance type t2.micro
* **View the EC2 instance:**

  * Go to **EC2 > Instances**, look for cli-created, verify it’s “Running”. Hint: Refresh if the instance doesn’t appear.

### Validation of the Lab

* Make sure everything is correct. In the IP Lab Portal, click **Check my work** to check if both CloudFormation stacks created the VPCs and subnets correctly.

### End lab

1. Sign out of the AWS Management Console by clicking your username (top-right) and selecting **Sign out**.
2. In the lab console, click **End lab** from your dashboard and wait for it to finish.
3. You’ve completed the EC2 CLI commands challenge!

## What gets checked

When you press **Check my work**, the platform verifies each of these:

* **Launch an EC2 Instance** — Check whether an EC2 Instance is launched or not.
* **Validate EC2 Instance Type t2.micro** — Check whether the EC2 instance type is t2.micro.
* **Launch EC2 AMI type Amazon Linux** — Check whether the EC2 instance is launched using an Amazon AMI.

## Related help

* [FAQs and Troubleshooting](/aws-cp/support/faqs-and-troubleshooting)
* [SSH into EC2 Instance](/aws-cp/support/ssh-into-ec2-instance)
