aws_assume_role
Assume an AWS role using STS and store temporary credentials as a local named profile in ~/.aws/credentials for cross-account access, without returning raw secret keys.
Instructions
Call STS AssumeRole and stash the returned temporary credentials as a named profile in ~/.aws/credentials. Subsequent calls to aws_call / aws_whoami / aws_paginate can use profile='mcp-' (or your overridden targetProfile name). The raw secret key / session token are NOT returned to the caller — only the profile name, expiration, and assumed identity. Use for cross-account access: a source profile (your SSO identity) assumes a role in another account. Default timeout is 120s (raise via timeoutMs for slow SAML / credential_process setups on cold start).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| roleArn | Yes | Target role ARN, e.g. 'arn:aws:iam::123456789012:role/CrossAccountAdmin'. | |
| sessionName | Yes | Role session name (shows up in CloudTrail). Alphanumeric + +=,.@- only. | |
| durationSeconds | No | Session duration in seconds (900-43200). Default 3600. | |
| externalId | No | External ID (only required if the role's trust policy demands it). | |
| sourceProfile | No | Profile to use as the assuming identity. Defaults to session profile / $AWS_PROFILE / 'default'. | |
| targetProfile | No | Profile name to write the temp creds under. Default 'mcp-<sessionName>'. Auto-prefixed with 'mcp-' if missing. | |
| region | No | Region for the STS call. Defaults to session region / $AWS_REGION. | |
| timeoutMs | No | Timeout in milliseconds for the underlying STS AssumeRole CLI call. Default 120000 (120s) -- gives cold-start SAML / credential_process setups headroom over runAwsCall's 60s default. Raise further for unusually slow IdPs. |