Free tool
Lambda execution role policy generator
Pick the services your Lambda calls and get the execution role it needs — scoped to the right ARNs, with the reason behind every action.
1. Which thing needs the role?
The compute that makes the calls. It assumes the role; everything else is a resource the role points at.
Changing this opens that principal’s own page.
2. What does it call?
Only connections the knowledge base records IAM requirements for. Tick what your Lambda actually talks to.
3. Fill in your account (optional)
Leave these blank and the ARNs keep visible placeholders, so a half-finished policy fails instead of quietly granting more than you meant.
Your role
Nothing selected yet, so the role below can be assumed but grants nothing. Tick a service above.
{
"Version": "2012-10-17",
"Statement": []
}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "LambdaAssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Before you apply this
- These are the actions this integration typically needs — not a least-privilege proof. After you deploy, narrow the policy with IAM Access Analyzer, which generates one from the calls the principal actually made.
- No permissions were generated. The role below can be assumed but grants nothing — pick at least one service this principal calls.
Worth knowing about a Lambda execution role
- Lambda assumes this role for you — the function's SDK picks up temporary credentials from the environment, so never put access keys in environment variables or the deployment package.
Grounded in the same data that validates diagrams
Design Beaver models AWS connections so it can tell you when a diagram is wrong. Part of that model is which IAM actions each integration needs and why — researched against AWS documentation, not inferred. This tool reads that data directly, which is why it can explain every statement instead of just emitting one.
It also means the tool knows what it doesn’t know. A connection the knowledge base has no IAM data for is skipped and named, never filled in with a plausible guess. Where an action comes from somewhere other than the knowledge base, it is labelled.
What a Lambda execution role can be scoped to
Lambda assumes this role through the lambda.amazonaws.com service principal. These are the 7 connections the knowledge base records IAM requirements for:
- Lambda → DynamoDB
Lambda reads/writes DynamoDB items via the AWS SDK (typical serverless API backend pattern)
dynamodb:GetItemdynamodb:PutItemdynamodb:Querydynamodb:UpdateItemdynamodb:DeleteItemThe function's execution role must grant the DynamoDB actions it uses (e.g. dynamodb:GetItem/PutItem/Query/UpdateItem) on the target table — Lambda has no access without it
For the Streams trigger direction, DynamoDB Streams must be enabled on the table and the execution role additionally needs the stream-read actions (the AWSLambdaDynamoDBExecutionRole-equivalent permissions)
- Lambda → EventBridge
Lambda publishes a custom event to an event bus with PutEvents, so other services can react through EventBridge rules without the function calling them directly — the producer stays decoupled from its consumers
events:PutEventsThe execution role needs events:PutEvents on the target event bus; each event entry must be under 256 KB (and a PutEvents request under 1 MB)
- Lambda → S3
Lambda reads/writes S3 objects via the AWS SDK (e.g. generate a thumbnail and write it back to a bucket)
s3:GetObjects3:PutObjects3:ListBucketThe function's execution role must grant the S3 actions it uses (e.g. s3:GetObject/s3:PutObject) on the target bucket/prefix — Lambda has no access to the bucket without it, and credentials should come from the role, never hardcoded keys
- Lambda → Secrets Manager
The function reads a secret (e.g. the database credentials for its RDS/RDS Proxy connection, or a third-party API key) from Secrets Manager at runtime via the AWS SDK instead of storing it in an environment variable
secretsmanager:GetSecretValuesecretsmanager:DescribeSecretGrant secretsmanager:GetSecretValue (and secretsmanager:DescribeSecret) on the specific secret to the function's execution role — the SDK fetches the value using the function's temporary credentials, so no long-lived secret sits in the deployment package or environment. Cache the fetched value across warm invocations rather than calling on every request
- Lambda → SES
Lambda sends transactional email through SES — e.g. a worker triggered by an SQS queue sends the confirmation email for a CRUD write
ses:SendEmailses:SendRawEmailThe execution role needs ses:SendEmail (plus ses:SendRawEmail for MIME messages or attachments), scoped to the ARN of the verified sending identity
- Lambda → SNS
Lambda publishes a message to an SNS topic to fan an event out to multiple subscribers (e.g. notify several downstream systems after a write)
sns:PublishThe execution role needs sns:Publish on the target topic
- Lambda → SQS
Lambda sends messages to an SQS queue to decouple work — e.g. an API handler enqueues an email/notification job instead of doing it inline in the request
sqs:SendMessagesqs:ReceiveMessagesqs:DeleteMessagesqs:GetQueueAttributesAs a producer the execution role needs sqs:SendMessage on the queue; as a consumer (queue trigger) it needs sqs:ReceiveMessage, sqs:DeleteMessage, and sqs:GetQueueAttributes — the AWSLambdaSQSQueueExecutionRole-equivalent permissions
Generate a role for something else
- EC2instance profile roleDynamoDB · EventBridge · Lambda · S3 · Secrets Manager · SES · SNS · SQS
- IoT Corerule action roleDynamoDB · Lambda · S3 · SNS · SQS · Step Functions
- Step Functionsstate machine execution roleDynamoDB · EventBridge · Lambda · S3 · SNS · SQS
- CodeBuildservice roleCodeArtifact · CodeCommit · ECR · S3 · Secrets Manager
- ECStask roleDynamoDB · S3 · Secrets Manager · SNS · SQS
- App Runnerinstance roleDynamoDB · S3 · Secrets Manager
- API Gatewayintegration roleDynamoDB · Step Functions
Questions
Where do the actions come from?
Is this a least-privilege policy?
How is this different from the other IAM policy generators?
Does anything I type leave my browser?
Why are there two policies?
Draw it instead, and the role attaches itself
Design Beaver knows which connections need a role because it checks them as you draw. Drop an IAM Role node onto a function and the warnings it resolves disappear. Free, in your browser — sign in with Google or GitHub to save your work.
Sign up for free! →Prefer email? Get new features in your inbox: