# AWS

Installing P0 IAM management on AWS takes about 10 minutes.

### Before you begin

* Choose at least one account on which to install P0.
* Make sure you have the ability to create roles, add trust relationships, and create and assign role polices. You can do this if you have the [IAMFullAccess managed policy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/IAMFullAccess.html) attached to your user.

### Setting up AWS IAM management

{% hint style="info" %}
For fine-grained Kubernetes access in EKS use the [P0 Kubernetes integration](/integrations/resource-integrations/kubernetes.md).
{% endhint %}

1. Navigate to "Integrations" on [p0.app](https://p0.app), then select "AWS". Choose the "IAM management" component:

<figure><img src="/files/oquAhMb0mBYOJ09LP6wn" alt="" width="563"><figcaption></figcaption></figure>

2. Click the "Add account" button to begin the installation

<figure><img src="/files/z4gQZ03LnBvoPUrcLSjg" alt="" width="563"><figcaption></figcaption></figure>

3. Enter an AWS numeric account ID, then click "Next".

<figure><img src="/files/z5wK5Io1jQJKkDVbrUjT" alt="" width="563"><figcaption></figcaption></figure>

4. The next page will display commands you can run using the AWS CLI to provision P0. You can also run these commands using AWS Cloud Shell.

<figure><img src="/files/GEXzt4K8bsrybnZOTW1p" alt="" width="563"><figcaption></figcaption></figure>

5. Copy and run these commands or use the Terraform configuration to deploy the changes. Click "Next" to verify the installation. If verification is successful you will be taken to the integration configuration page.

<figure><img src="/files/W7bGF1OVzFzIA6xAO4a4" alt="" width="563"><figcaption></figcaption></figure>

### Configuring P0 with AWS

On the configuration page, you define how users are provisioned in AWS:

{% tabs %}
{% tab title="As AWS IAM users" %}
If users are defined in the account's IAM service, choose "As AWS IAM users".

If the user's names equal their email addresses choose "User name is user email".

If users are defined in the account's IAM service, but their user names do not equal their email, you'll need to add a tag to each user you want to allow access via P0. For example, with a tag named "Email":

<figure><img src="/files/OVE6o1Qxn6PaAhd30jm1" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/KhgU3e8n9oIejaIQZVAq" alt="" width="459"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Via AWS Identity Center" %}
If users are provisioned via Identity Center (for example, if you provision via SSO), choose "Via AWS Identity Center".

A few requirements apply:

* P0 must be installed on the management account where the Identity Center instance resides
* Users must be provisioned with user names equal to user email addresses

To finish the configuration, select the management account in which the Identity Center instance resides and click "Next".

<figure><img src="/files/OGhwC1ArOSI6FpfmIKhb" alt="" width="422"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Via a federated identity provider" %}
If you use an IAM identity provider to sign in users to your AWS account choose "Via a federated identity provider". This is a legacy sign in method. AWS recommends using Identity Center.

{% hint style="info" %}
Currently only Okta SAML federation is supported via an AWS Account Federation.

An installed [Okta directory integration](/integrations/directory-integrations/okta.md) is required. Your AWS Account Federation Okta app must be in the same Okta organization as the one installed as the directory integration.
{% endhint %}

Saving the configuration by clicking "Next" automatically applies the following changes to your AWS Account Federation app:

* Adds a custom attribute `managedByP0` to your Okta app's user profile. This allows P0 to clean up dynamically assigned users from your AWS SSO Okta app.
* Enables the [`Join all roles`](https://help.okta.com/en-us/content/topics/deploymentguides/aws/aws-configure-aws-app.htm) flag. This allows users to assume AWS roles assigned by P0 directly to their Okta user.

<figure><img src="/files/H2KmylvLc4GtEbVzzwTX" alt="" width="499"><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

### Setting up AWS resource inventory

Installing P0 resource inventory on AWS takes about 10 minutes.

The resource inventory component extends the IAM management integration and allows requesting [fine-grained resource-level](/integrations/resource-integrations/aws/requesting-access.md#fine-grained-resource-level-access) access in AWS.

{% hint style="info" %}
An installed AWS IAM management integration is required
{% endhint %}

1. Navigate to "Integrations" on [p0.app](https://p0.app), then select "AWS". Choose the "Resource inventory" component:

<figure><img src="/files/oquAhMb0mBYOJ09LP6wn" alt="" width="563"><figcaption></figcaption></figure>

2. Click "Add account"

<figure><img src="/files/wOjhtUBgqT8olp6ze1bc" alt="" width="563"><figcaption></figcaption></figure>

3. Choose one of the AWS accounts already installed for IAM management:

<figure><img src="/files/7UXfgMD0eYoBfbrHoPEW" alt="" width="563"><figcaption></figcaption></figure>

4. Run the AWS CLI commands to configure Resource Explorer

<figure><img src="/files/mloqJw1rQrEjneavX6In" alt="" width="563"><figcaption></figcaption></figure>

5. Click "Next" to validate your setup. You will land on the resource inventory configuration page. Clicking "Next" again takes you back to the Resource inventory overview page.

<figure><img src="/files/XCWuYwPfvV5G0nKepE6P" alt="" width="563"><figcaption></figcaption></figure>

And that's it. You're all set to start granting just-in-time, least-privileged access to AWS with P0.


---

# 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://docs.p0.dev/integrations/resource-integrations/aws.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.
