# Lab 3-2: AWS EC2 with CLI - Lab 2

### **Submit Screenshot:** Use the describe-instances command to just output the **instance-ids** of **running** instances

{% code overflow="wrap" %}

```
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" --query 'Reservations[*].Instances[*].{InstanceId:InstanceId}'
```

{% endcode %}

<figure><img src="https://1702353884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg4BXXN6DhMLmwASC6sFj%2Fuploads%2FKJd1aLjasjkZyn2ToIrO%2Fimage.png?alt=media&#x26;token=7e6fd96b-9e94-455a-80b0-a43086662858" alt=""><figcaption></figcaption></figure>

### **Submit Screenshot:** Use the describe-instances command to just output the **instance-ids** and **public IP address** of **running instances**

{% code overflow="wrap" %}

```
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" --query 'Reservations[*].Instances[*].{InstanceId:InstanceId, IP:PublicIpAddress}'
```

{% endcode %}

<figure><img src="https://1702353884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg4BXXN6DhMLmwASC6sFj%2Fuploads%2FNz7KzbhxldpPjp6qQZaz%2Fimage.png?alt=media&#x26;token=54b196e7-5393-4160-af91-7bfdea456b6c" alt=""><figcaption></figcaption></figure>

### **Submit Screenshot:**  Use the describe-instances command to just output the **instance-ids** and **public IP address** of only **Windows**

{% code overflow="wrap" %}

```
aws ec2 describe-instances --filters "Name=platform,Values=windows" --query 'Reservations[*].Instances[*].{InstanceId:InstanceId, IP:PublicIpAddress, OS:PlatformDetails}'
```

{% endcode %}

<figure><img src="https://1702353884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg4BXXN6DhMLmwASC6sFj%2Fuploads%2F6IJ1rAFXHBjtA3FOZYjw%2Fimage.png?alt=media&#x26;token=347c642f-24fc-43d5-893a-635ea2b25c62" alt=""><figcaption></figcaption></figure>

### Connect Windows Instance (RDP)

Get the password of the windows instance

{% code overflow="wrap" %}

```
aws ec2 get-password-data --instance-id i-0047b8aa669bc50ff --priv-launch-key .\Paul-360.pem
```

{% endcode %}

<figure><img src="https://1702353884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg4BXXN6DhMLmwASC6sFj%2Fuploads%2FHv2p0XGDhRew4MAp06xk%2Fimage.png?alt=media&#x26;token=2d2aed5c-6770-4778-b6df-20da004de117" alt=""><figcaption></figcaption></figure>

Username for windows rdp is administrator (Make sure to open rdp in security group)

<figure><img src="https://1702353884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg4BXXN6DhMLmwASC6sFj%2Fuploads%2F9laQ0POKOuhnyn6E9ULK%2Fimage.png?alt=media&#x26;token=891f1de7-026b-4cae-aa61-f73e45b8e202" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://paul-gleason.gitbook.io/champlain-college-classes/sys-360-cloud-admin/labs/lab-3-2-aws-ec2-with-cli-lab-2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
