AWS role assumption
Access and integrationGive Factory access to your AWS account using an IAM role.
Why use an AWS role?
A Factory can use AWS services on your behalf by assuming an IAM role in your AWS account. You choose what the role can do, and Factory obtains temporary credentials for that role. You do not need to provide your AWS access keys.
This setup supports the standard AWS commercial partition (aws). Please get
in touch if you need access to AWS GovCloud or AWS China partitions.
Create a role for Factory
- In your AWS account, create an IAM role with the trust policy below. It
allows Factory to call
sts:AssumeRoleon that role. - Attach a permissions policy to the role granting only the AWS actions and resources your workflow needs. The trust policy controls who may assume the role; the permissions policy controls what the resulting session can do.
- Copy the role ARN to
aws.role_arnin your Factory organization configuration. If your trust policy requires an external ID, also setaws.external_idto the same value.
Trust policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::860892315863:user/dotFactory-customer-role-assumer"
},
"Action": "sts:AssumeRole"
}
]
}
For a complete example with Terraform and an S3 permissions policy, see AWS role setup with Terraform.
Use the role in a factory
Declare the port and use your configured role ARN to obtain credentials:
type AwsCredentials = {
access_key_id: secret
secret_access_key: secret
session_token: secret
expires_at: time
}
external port config(key: text, default?: text) -> text
external port aws_assume_role(role_arn: text, external_id?: text, duration_seconds?: int) -> AwsCredentials
# Use as an input to a step that accepts AWS credentials:
credentials: aws_assume_role(role_arn: config(key: "aws.role_arn"))
# If the role requires an external ID:
credentials: aws_assume_role(role_arn: config(key: "aws.role_arn"), external_id: config(key: "aws.external_id"), duration_seconds: 900)
Each call obtains a fresh session, valid for one hour by default. You can set
duration_seconds from 900 to 43200 seconds, subject to AWS role limits. There
is no automatic refresh, so obtain a new session after expiration. Pass the
credentials to an adapter or trusted container that accepts secret inputs; the
existing S3 effect does not yet accept this credential record. Secret fields
are redacted in run observations and generic file output.
To revoke access, remove the role or its trust for Factory. Previously issued sessions can remain valid until they expire.
Your factories will appear here. Create one and open it beside this guide.