> For the complete documentation index, see [llms.txt](https://paul-gleason.gitbook.io/champlain-college-classes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://paul-gleason.gitbook.io/champlain-college-classes/sys-360-cloud-admin/labs/lab-3-2-aws-ec2-with-cli-lab-2.md).

# 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="/files/qJ4gQwfXudtqT2wUQcxF" 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="/files/gyYGTWbf8i9uegWZQY3N" 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="/files/IGxVHGUhAWMakRi8Jl4c" 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="/files/YHiAwmvzVBZYjrEQndS8" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/bIBlDmqmzMzJeJ2bsiJU" alt=""><figcaption></figcaption></figure>
