> ## Documentation Index
> Fetch the complete documentation index at: https://namespace.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# nsc aws assume-role

Uses Workload Federation to assume a particular AWS role.

`aws assume-role` uses Namespace [Workload Federation](/docs/federation) to assume an AWS IAM role. This allows your Namespace workloads to securely access AWS resources without long-lived credentials.

## Usage

```bash theme={null}
nsc aws assume-role --role_arn <arn>
```

### Example

```bash theme={null}
nsc aws assume-role --role_arn arn:aws:iam::123456789012:role/my-role
```

```text nocopy Output theme={null}
Obtained credentials from Namespace (took 234ms).
Obtained credentials from AWS (took 456ms).
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_SESSION_TOKEN=AQoDYXdzEJr...
```

## Options

<h3 id="--role_arn-arn">
  \--role\_arn \<arn>
</h3>

The ARN of the role to assume.

<h3 id="--aws_profile-profile">
  \--aws\_profile \<profile>
</h3>

Use the specified AWS profile.

<h3 id="--write_env-path">
  \--write\_env \<path>
</h3>

Instead of outputting, write the environment variables to the specified file.

<h3 id="--duration-duration">
  \--duration \<duration>
</h3>

For how long the resulting AWS credentials should be valid for. Default is `1h`.
