Skip to content

ecs s3 environment's arn path is incorrect if partition is aws-gov #18429

@ivyxjc

Description

@ivyxjc

What is the problem?

We use aws-gov cloud. And I try to bind s3 environment to ecs. The generated cloud formation of the config is still
arn:aws:s3:::.....

following is the sample code

const bucket = s3.Bucket.fromBucketArn(this, `${props.resourcePrefix}-Bucket`, `arn:aws-us-gov:s3:::${props.configBucket}`)
....

const container = taskDefinition.addContainer(`${props.resourcePrefix}-Web`, {
      containerName: `${props.resourcePrefix}-Web`,
      image: ecs.ContainerImage.fromEcrRepository(repo, props.tag),
      memoryReservationMiB: props.containerMemoryReservation,
      logging,
      environmentFiles: [EnvironmentFile.fromBucket(bucket, `${props.configPath}`)]
    });

I review the source code of aws-cdk, I think the following code is the root cause. The arn may should use bucket's arn otherwise hard code arn:aws:s3:::....

value: `arn:aws:s3:::${s3Location.bucketName}/${s3Location.objectKey}`,

Reproduction Steps


What did you expect to happen?

cloud formation of the container environment should start with arn:aws-gov:s3:::.....

What actually happened?

cloud formation of the container environment starts with arn:aws:s3:::.....

CDK CLI Version

2.8.0 (build 8a5eb49)

Framework Version

No response

Node.js Version

v16.13.1

OS

macOS 12.1 21C52 arm64

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecsRelated to Amazon Elastic ContainerbugThis issue is a bug.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions