Skip to content

(step-functions): (The state machine IAM Role is not authorized to access the Log Destination) #26432

Description

@pete-mcneill

Describe the bug

Using a custom log group for a while to prefix "vendedlogs" to the log group name for our State Machines.

This has worked previously but this week it has started throwing an error.

Expected Behavior

new sfn.StateMachine(this, "TechnicalData", { stateMachineName: Stack.of(scope).stackName.toLowerCase() + "_TechnicalData", definition: technicalData, tracingEnabled: true, logs: { destination: new LogGroup(this, "TechnicalDataLogGroup", { logGroupName: '/aws/vendedlogs/states/${Stack.of( this ).stackName.toLowerCase()}_TechnicalData', }), level: LogLevel.ALL, }, });

Using this code will generate a State Machine with Log Group.

Current Behavior

Deployment failed with an error:

Resource handler returned message: "The state machine IAM Role is not authorized to access the Log Destination (Service: AWSStepFunctions; Status Code: 400; Error Code: AccessDeniedException; Request ID: 3dde30f8-e3fe-49a5-a424-14c41192ebb0; Proxy: null)" (RequestToken: 43782337-d13f-cbb3-e093-cfe71ed4bcd9, HandlerErrorCode: AccessDenied)

Reproduction Steps

Deploy with a log group that has a logGroupName assigned.

Possible Solution

Tried manually adding the suggested Policy from:
https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html#cloudwatch-iam-policy

Had success with this but CDK should already be adding this policy on deploy.

Additional Information/Context

No response

CDK CLI Version

2.47.0 (build 3528e3d)

Framework Version

No response

Node.js Version

16

OS

Linux

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions