> For the complete documentation index, see [llms.txt](https://docs.0xrushi.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.0xrushi.xyz/cloud-security/aws-cheatsheet.md).

# AWS CHEATSHEET

## IAM Enumeration Cheat Sheet

#### **1. List IAM Users**

```shell
aws iam list-users
```

#### **2. Get User Permissions**

**a. List attached managed policies**

```shell
aws iam list-attached-user-policies --user-name [user-name]
```

**b. List inline policies**

```shell
aws iam list-user-policies --user-name [user-name]
```

**c. Get inline policy details**

```shell
aws iam get-user-policy --user-name [user-name] --policy-name [policy-name]
```

#### **3. List IAM Groups and Permissions**

**a. List groups for a user**

```shell
aws iam list-groups-for-user --user-name [user-name]
```

**b. List group policies**

```shell
aws iam list-attached-group-policies --group-name [group-name] aws iam list-group-policies --group-name [group-name]
```

**c. Get inline group policy details**

```
aws iam get-group-policy --group-name [group-name] --policy-name [policy-name]
```

***

### 4. List IAM Roles and Permissions

<table><thead><tr><th>Command</th><th width="374">Description</th></tr></thead><tbody><tr><td><code>aws iam list-roles</code></td><td>List all roles</td></tr><tr><td><code>aws iam get-role --role-name [role-name]</code></td><td>Get role details (trust policy)</td></tr><tr><td><code>aws iam list-attached-role-policies --role-name [role-name]</code></td><td>List attached policies</td></tr><tr><td><code>aws iam list-role-policies --role-name [role-name]</code></td><td>List inline policies</td></tr><tr><td><code>aws iam get-role-policy --role-name [role-name] --policy-name [policy-name]</code></td><td>Get inline role policy details</td></tr><tr><td></td><td></td></tr></tbody></table>

### 5. Get and Decode Policy Documents

| Command                                                                          | Description                          |
| -------------------------------------------------------------------------------- | ------------------------------------ |
| `aws iam get-policy --policy-arn [policy-arn]`                                   | Get a managed policy document by ARN |
| `aws iam get-policy-version --policy-arn [policy-arn] --version-id [version-id]` | Get specific policy version          |

### 6. View Full IAM Snapshot

| Command                                                          | Description                                               |
| ---------------------------------------------------------------- | --------------------------------------------------------- |
| `aws iam get-account-authorization-details`                      | Dump all IAM permissions (users, roles, groups, policies) |
| `aws iam get-account-authorization-details --filter RoleDetail`  | Filter to roles only                                      |
| `aws iam get-account-authorization-details --filter UserDetail`  | Filter to users only                                      |
| `aws iam get-account-authorization-details --filter GroupDetail` | Filter to groups only                                     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.0xrushi.xyz/cloud-security/aws-cheatsheet.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
