Skip to content

Commit 6e0cb2b

Browse files
authored
fix(stepfunctions-tasks): athenaStartQueryExecution task generates invalid s3 arn (#22692)
Fixes #22608. The attached issue has all the necessary information, but the gist is that #22314 mistakenly added region/account information to the generated s3 arn, while s3 bucket names are globally unique in a partition: https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-arn-format.html ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent d0b34a9 commit 6e0cb2b

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts

+4
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ export class AthenaStartQueryExecution extends sfn.TaskStateBase {
109109
resources: [
110110
this.props.resultConfiguration?.outputLocation?.bucketName
111111
? cdk.Stack.of(this).formatArn({
112+
// S3 Bucket names are globally unique in a partition,
113+
// and so their ARNs have empty region and account components
114+
region: '',
115+
account: '',
112116
service: 's3',
113117
resource: this.props.resultConfiguration?.outputLocation?.bucketName,
114118
resourceName: this.props.resultConfiguration?.outputLocation?.objectKey,

packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,7 @@ describe('Start Query Execution', () => {
216216
{
217217
Ref: 'AWS::Partition',
218218
},
219-
':s3:',
220-
{
221-
Ref: 'AWS::Region',
222-
},
223-
':',
224-
{
225-
Ref: 'AWS::AccountId',
226-
},
227-
':query-results-bucket/folder',
219+
':s3:::query-results-bucket/folder',
228220
],
229221
],
230222
},

0 commit comments

Comments
 (0)