feat(iam): add Athena service integration permissions#769
Merged
Conversation
Auto-generates the IAM execution role permissions documented at https://docs.aws.amazon.com/step-functions/latest/dg/connect-athena.html for state machines that invoke Athena. Without this, Athena queries fail at runtime because the state machine's role lacks the necessary catalog and storage grants. - New iamStrategies/athena.js handles the five integration ARNs: startQueryExecution(.sync), stopQueryExecution, getQueryExecution, getQueryResults - For startQueryExecution(.sync), grants the full action set plus S3, Glue, and Lake Formation permissions per AWS template — Athena uses the caller identity for catalog and data access - Resource scoping: workgroup/<name> when WorkGroup is a static string, workgroup/* when it is a runtime path or absent - Standalone get/stop actions scope to workgroup/* (resource is identified at runtime by QueryExecutionId) - getQueryResults additionally grants s3:GetObject for the result location - Athena .sync uses polling, not EventBridge — no events:Put* permission (unlike sagemaker .sync) - Integration fixture exercises three machines (sync, request-response with static WorkGroup, request-response with runtime WorkGroup) and asserts the generated CF role matches AWS's documented template Closes #450 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #450
Summary
startQueryExecution(.sync),stopQueryExecution,getQueryExecution,getQueryResults.startQueryExecution(.sync), emits the fullathena:action set plus S3, Glue, and Lake Formation statements — Athena uses the caller identity for catalog and data access, so the state machine's role itself needs these grants.workgroup/<name>whenWorkGroupis a static string in the state's parameters,workgroup/*for runtime paths or absence.datacatalog/*always included alongside..syncuses polling rather than the EventBridgeStepFunctionsGetEventsForXxxRulepattern — noevents:*permission (unlikesagemaker.sync).getQueryResultsadditionally grantss3:GetObjectfor the result location.WorkGroup, request-response with runtimeWorkGroup) and asserts the generated CF role matches AWS's documented template.Test plan
athena.test.js— 12 tests)fixtures/athena/verify.test.js— 11 tests)🤖 Generated with Claude Code