---
updatedAt: 2026-09-10T12:26:44.000Z
agentTools:
  projectIndex: https://docs.akeyless.io/llms.txt
---

# AWS IAM

AWS Identity and Access Management (IAM)

This page discusses creating and using an AWS IAM-based authentication method in Akeyless.

[AWS IAM](https://aws.amazon.com/iam/) authentication provides an automated flow to retrieve an Akeyless token for IAM principals and AWS services or resources.

AWS IAM authentication is intended for **workload authentication** and is not recommended for direct interactive Console sign-in.

## AWS Partition Support

For partition requirements, ARN partition examples, and STS endpoint guidance, see [AWS Partition and Deployment Support](https://docs.akeyless.io/docs/aws-partition-and-deployment-support#aws-partition-support).

## AWS Deployment Pattern Support

For deployment pattern coverage and support status definitions, see [AWS Partition and Deployment Support](https://docs.akeyless.io/docs/aws-partition-and-deployment-support#aws-deployment-pattern-support).

![AWS IAM role-based authentication flow for obtaining an Akeyless token.](https://files.readme.io/c1f9c5b-Role_new_design.png)

## Creating an AWS IAM Authentication Method

This action is distinct from creating a new Akeyless account: it creates an additional AWS IAM-based authentication method for an existing account.

Required AWS IAM setting:

* **Bounded AWS Account IDs:** Configure one or more AWS account IDs that are allowed to authenticate by using this authentication method.
  In the Console, enter values as a comma-separated list (for example, `123456789012,210987654321`).
  With the CLI, repeat `--bound-aws-account-id` for each value.

### Creating an AWS IAM Authentication Method with the Console

To create a new AWS IAM-based authentication method with the Console:

1. In the Console, under **Administration**, navigate to **Users & Auth Methods**.
2. Select **+ New**. This opens the **Create Authentication Method** form.
3. On the **Type** selection screen, select **AWS IAM**, then **Next →**.
4. Enter a name for the Authentication Method in the **Name** field. Optionally, include a path using `/` separators to place the Authentication Method in a virtual folder, then select **Next →**.
5. Configure AWS IAM-specific fields as needed. For field details, see [AWS IAM-Specific Optional Features](#aws-iam-specific-optional-features), then select **Finish**.

### Creating an AWS IAM Authentication Method with the CLI

To create an AWS IAM-based authentication method with the CLI:

```shell
akeyless auth-method create aws-iam \
  --name <AWS IAM Auth Method Name> \
  --bound-aws-account-id <AWS Account ID>
```

You can provide multiple AWS account IDs by repeating `--bound-aws-account-id`.

[Read about more parameters available when creating an AWS IAM-based authentication method.](https://docs.akeyless.io/docs/cli-ref-auth#create)

## Using an AWS IAM Authentication Method

### Using an AWS IAM Authentication Method with the CLI

To use an AWS IAM-based authentication method with a CLI profile, run the [Akeyless configure command](https://docs.akeyless.io/docs/cli-reference#configure) from an AWS resource (for example, Amazon EC2 instances or containers within an Amazon EKS cluster):

```shell
akeyless configure \
  --profile default \
  --access-id <Access ID> \
  --access-type aws_iam
```

To inspect the cloud identity token, run the [Akeyless get-cloud-identity command](https://docs.akeyless.io/docs/cli-ref-auth#get-cloud-identity):

```shell
akeyless get-cloud-identity \
  --cloud-provider aws_iam
```

To authenticate and retrieve a temporary Akeyless token, run the [Akeyless auth command](https://docs.akeyless.io/docs/cli-ref-auth#auth):

```shell
akeyless auth \
  --access-id <Access ID> \
  --access-type aws_iam
```

<Callout icon="ℹ️" theme="info">
  ### **Least Privilege:**

  AWS IAM authentication does not require privileged AWS permissions. Attach a minimally privileged IAM role to the resource that authenticates to Akeyless (for example, an EC2 instance, ECS task, or EKS pod).
</Callout>

## Associate with Access Roles

After creating the authentication method, associate it with one or more Access Roles so authenticated identities can perform actions in Akeyless.

1. In the Console, under **Administration**, navigate to **Users & Auth Methods**.
2. Select the AWS IAM authentication method.
3. Add the required Access Roles.
4. Save the changes.

For role configuration details, see [Access Roles](https://docs.akeyless.io/docs/rbac).

## Update an Existing AWS IAM Authentication Method

AWS IAM authentication methods can require updates over time, for example when bounded account IDs, ARNs, or related constraints change.

To update in the Console:

1. In the Console, under **Administration**, navigate to **Users & Auth Methods**.
2. Select the AWS IAM authentication method to update.
3. Update the required fields.
4. Save the changes.

To update with the CLI, use the relevant `akeyless auth-method update aws-iam` flags in [CLI Reference - Authentication](https://docs.akeyless.io/docs/cli-ref-auth#update).

## Troubleshooting

If AWS IAM authentication fails, check the following:

* The workload is running with the expected IAM principal.
* The workload account matches configured bounded account IDs, ARNs, or other bounded fields.
* The configured **Access ID** and `aws_iam` access type are correct.
* For EC2-based flows, verify instance metadata service settings and hop limit requirements.

## Optional Features

For optional features that apply across Authentication Methods, see [Common Optional Features](https://docs.akeyless.io/docs/access-and-authentication-methods#common-optional-features).

### AWS IAM-Specific Optional Features

* **Bounded ARNs:** Enter one or more full IAM role or user ARNs that are allowed to authenticate by using this method. In the Console, enter values as a comma-separated list. With the CLI, repeat `--bound-arn` for each value. Supports wildcard patterns such as `*` and `?`.
* **Bounded Role Names:** Enter one or more IAM role names that are allowed to authenticate. In the Console, enter values as a comma-separated list. With the CLI, repeat `--bound-role-name` for each value.
* **Bounded Role IDs:** Enter one or more IAM role IDs that are allowed to authenticate. In the Console, enter values as a comma-separated list. With the CLI, repeat `--bound-role-id` for each value.
* **Bounded User names:** Enter one or more IAM user names that are allowed to authenticate. In the Console, enter values as a comma-separated list. With the CLI, repeat `--bound-user-name` for each value.
* **Custom STS Endpoint:** Set a custom AWS STS endpoint URL if your environment requires a non-default endpoint. If not set, Akeyless uses `https://sts.amazonaws.com`. For partition-specific requirements and examples (`aws`, `aws-us-gov`, and `aws-cn`), see [AWS Partition and Deployment Support](https://docs.akeyless.io/docs/aws-partition-and-deployment-support#aws-partition-support).
* **Unique Identifier:** Set a sub-claim key used to uniquely identify authenticated IAM principals.

## AWS Instance Metadata Service

By default, the Amazon EC2 [Instance Metadata Service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html) (IMDSv2) enforces a hop limit of `1`. This means the metadata token used for cloud identity (for example, IAM role credentials) must be accessed directly from the EC2 instance that initiated the session.

If the Akeyless Gateway runs in a different network context (for example, inside a container), authentication with `aws_iam` may fail because of this hop limit.

To resolve this, increase the allowed number of network hops by changing the `http-put-response-hop-limit` parameter. You can do this by using the AWS CLI or AWS Management Console.

The following command increases the hop limit to `2`:

```shell
aws ec2 modify-instance-metadata-options \
  --instance-id <instance-id> \
  --http-put-response-hop-limit 2
```

This allows the metadata token to be accessed from nested network environments, such as containers, while still preserving IMDSv2 security protections.

If changing the instance metadata service hop limit is not possible, configure the Gateway Helm chart to use static environment variables under `globalConfig.env`:

```yaml
globalConfig:
  env:
    - name: CLUSTER_URL
      value: "https://gw.wz-aws.cs.akeyless.fans"
    - name: ADMIN_ACCESS_ID_TYPE
      value: "aws_iam"
```

Replace `CLUSTER_URL` with the Gateway URL for the relevant environment.

Alternatively, you can use IAM Roles for Service Accounts (IRSA) instead of adjusting the hop limit. When the Gateway Service Account authenticates via IRSA, the hop limit can remain at its default value of `1`. See the [EKS IRSA guide](https://docs.akeyless.io/docs/gateway-deploy-amazon-eks#eks-identity-delta) for setup instructions.

## Tutorial

Check out our tutorial video on [AWS IAM Authentication and Access](https://tutorials.akeyless.io/docs/aws-iam-authentication-and-access).