Skip to content

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 keyWorkflow role
LifetimeUntil someone rotates itAbout one hour, renewed by n8n
Stored in n8nYes, in the credentialNo, only the role ARN
PermissionsThose of the IAM userThose of the policies attached to the role
AuditOne user for every workflowCloudTrail 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>-workflows that trusts the task role, with the permissions boundary of aws.permissions_boundary when you set one;
  • lets the task role call sts:AssumeRole on it;
  • sets N8N_AWS_SYSTEM_CREDENTIALS_ACCESS_ENABLED=true on every n8n process;
  • prints the role ARN with plan and after deploy, and outputs it as WorkflowRoleArn.

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 ​

  1. Copy the ARN printed after deploy: arn:aws:iam::<account>:role/<name>-workflows.
  2. In n8n, create a credential of type AWS (Assume Role).
  3. Turn on Use System Credentials.
  4. Choose the region of the services you call, and paste the role ARN.
  5. Type any text in External ID. n8n requires a value, and a role without an external ID condition ignores it.
  6. 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:

yaml
aws:
  workflow_role:
    kind: create
    managed_policies:
      - arn:aws:iam::aws:policy/AmazonBedrockLimitedAccess

Or attach it with your usual IAM process, for example from the CLI:

shell
$ aws iam attach-role-policy --role-name n8n-workflows --policy-arn arn:aws:iam::aws:policy/AmazonBedrockLimitedAccess

For 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:

yaml
network:
  vpc:
    endpoints: [s3, bedrock-runtime]

An AI agent example ​

  1. Add an AI Agent node to a workflow.
  2. 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.
  3. 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.