Skip to content

The CDK deployment doesn't work in us-west-2 #202

@pxaws

Description

@pxaws

We have seen deployment failure when the region is us-west-2

LambdaPetClinicStack failed: ToolkitError: The stack named LambdaPetClinicStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "User: arn:aws:sts::385139013756:assumed-role/cdk-hnb659fds-cfn-exec-role-385139013756-us-west-2/AWSCloudFormation is not authorized to perform: lambda:GetLayerVersion on resource: arn:aws:lambda:us-east-1:615299751070:layer:AWSOpenTelemetryDistroPython:5 because no resource-based policy allows the lambda:GetLayerVersion action (Service: Lambda, Status Code: 403, Request ID: 2c9d5094-9a6b-4cb4-8f9e-7c2c331a35c5) (SDK Attempt Count: 1)" (RequestToken: 9179a13d-60be-6f08-f81b-8853baa62e64, HandlerErrorCode: AccessDenied)

It seems like something is wrong with the region determination:

const regionName = cdk.Stack.of(this).region;
const layerArn = layerArns[regionName] || layerArns['us-east-1']; // Default to us-east-1 if not found

When users choose us-west-2, it still use us-east-1 as the region. In this case, we will access the us-east-1 lambda layer in region us-west-2. This is not allowed because lambda layer is regional resource. So we got the above error.
@awsapm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions