Reach AWS services from workflows
A workflow that calls Amazon Bedrock, S3, SQS or Secrets Manager needs an AWS identity. The usual answer is an access key pasted into an n8n credential. That key never expires, anyone who can read the credential can copy it, and a security review rejects it first. A role gives the workflow short-lived credentials that AWS renews and that you can narrow in IAM.
Every deployment creates the role <name>-workflows, with no permission. This guide shows how to create the n8n credential from it, how to open Bedrock, and what happens at destroy. You need a deployment on ECS (Fargate or EC2 hosts) and the right to attach IAM policies. The terms are in concepts.
Why a role beats access keys
| Access key | Workflow role | |
|---|---|---|
| Lifetime | Until someone rotates it | About one hour, renewed by n8n |
| Stored in n8n | Yes, in the credential | No, only the role ARN |
| Permissions | Those of the IAM user | Those of the policies attached to the role |
| Audit | One user for every workflow | CloudTrail shows the session name n8n-session |
What the deployment creates
n8n starts from the identity of its container, the task role, and assumes <name>-workflows. The deployment:
- creates the role
<name>-workflowsthat trusts the task role, with the permissions boundary ofaws.permissions_boundarywhen you set one; - lets the task role call
sts:AssumeRoleon it; - sets
N8N_AWS_SYSTEM_CREDENTIALS_ACCESS_ENABLED=trueon every n8n process; - prints the role ARN with
planand afterdeploy, and outputs it asWorkflowRoleArn.
The keys are in the configuration reference. kind: none turns it all off, and kind: existing reuses a role from your platform team.
Create the n8n credential
- Copy the ARN printed after
deploy:arn:aws:iam::<account>:role/<name>-workflows. - In n8n, create a credential of type AWS (Assume Role).
- Turn on Use System Credentials.
- Choose the region of the services you call, and paste the role ARN.
- Type any text in External ID. n8n requires a value, and a role without an external ID condition ignores it.
- Save. The test of the credential calls
sts:AssumeRole.
The credential works in the same nodes as an access key, among them AWS Bedrock Chat Model, Embeddings AWS Bedrock, AWS S3, AWS SQS, AWS SNS and AWS Lambda. No paid edition is needed. The checks are in the options note.
Attach a Bedrock policy
With no policy, the role grants nothing, and the credential test passes while every call is denied. To open Bedrock, attach a policy to the role. For a team that wants it in the file, list it:
aws:
workflow_role:
kind: create
managed_policies:
- arn:aws:iam::aws:policy/AmazonBedrockLimitedAccessOr attach it with your usual IAM process, for example from the CLI:
$ aws iam attach-role-policy --role-name n8n-workflows --policy-arn arn:aws:iam::aws:policy/AmazonBedrockLimitedAccessFor a narrower grant, write a policy with bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream on the models you use, plus bedrock:ListFoundationModels to list them in the node. A redeploy keeps policies that you attached outside the file, because the template manages only managed_policies. Bedrock also needs model access in the region, which you request in the Bedrock console.
Workflows reach Bedrock through the NAT, or through the public address of the tasks when there is no NAT. To keep that traffic inside the VPC, add the interface endpoint. It costs about $7 per AZ a month, and plan --cost includes it:
network:
vpc:
endpoints: [s3, bedrock-runtime]An AI agent example
- Add an AI Agent node to a workflow.
- Add an AWS Bedrock Chat Model to its model input. Set Authentication to AWS (Assume Role), choose the credential, and pick a model that the policy allows. With a Bedrock cross-region model such as Nova Micro in Europe, pick it as an inference profile (
eu.amazon.nova-micro-v1:0), and allow that profile and the model in the policy. - Send a message through a chat trigger and read the answer.
A model that the policy does not allow fails with AccessDeniedException. That is the role doing its job: add the model to the policy to open it.
What destroy does with your policies
CloudFormation cannot delete a role that still carries policies it did not attach. Before it runs, n8n-on-aws destroy lists the policies attached to <name>-workflows outside the stack, managed and inline. It then stops with a hint, or detaches them after you answer y (--yes without a terminal). Managed policies are only detached, and inline policies are deleted. Policies listed in managed_policies are left to the stack.
A caution for shared instances
Any n8n user who can create credentials can create an AWS (Assume Role) credential with the role ARN and use everything the role allows. Every edition, community included, can have several users, so the edition says nothing about it. T23 reminds you of it. Attach only what every n8n user may use, or set kind: none and keep access keys for the few workflows that need them. n8n's own documentation gives the same advice for shared instances.
EKS
The workflow role is not synthesized on EKS yet, because n8n's use of Pod Identity needs a smoke test with the pinned version. Setting aws.workflow_role on EKS raises C1.