Skip to content

feat(iam): add Athena service integration permissions#769

Merged
zirkelc merged 1 commit into
masterfrom
feat/450_athena-iam
May 6, 2026
Merged

feat(iam): add Athena service integration permissions#769
zirkelc merged 1 commit into
masterfrom
feat/450_athena-iam

Conversation

@VirtueMe

@VirtueMe VirtueMe commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Closes #450

Summary

  • Auto-generates the IAM execution role grants documented at https://docs.aws.amazon.com/step-functions/latest/dg/connect-athena.html for all five Athena integration ARNs: startQueryExecution(.sync), stopQueryExecution, getQueryExecution, getQueryResults.
  • For startQueryExecution(.sync), emits the full athena: 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 scoping: workgroup/<name> when WorkGroup is a static string in the state's parameters, workgroup/* for runtime paths or absence. datacatalog/* always included alongside.
  • Athena .sync uses polling rather than the EventBridge StepFunctionsGetEventsForXxxRule pattern — no events:* permission (unlike sagemaker.sync).
  • getQueryResults additionally grants s3:GetObject for the result location.
  • Integration fixture exercises three state machines (sync, request-response with static WorkGroup, request-response with runtime WorkGroup) and asserts the generated CF role matches AWS's documented template.

Test plan

  • Unit: Athena strategy (athena.test.js — 12 tests)
  • Verify fixture against generated CF template (fixtures/athena/verify.test.js — 11 tests)
  • Manual smoke deploy with a state machine running an Athena query

🤖 Generated with Claude Code

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>
@pkg-pr-new

pkg-pr-new Bot commented May 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/serverless-operations/serverless-step-functions@769

commit: 99d12c9

@zirkelc zirkelc merged commit 92073df into master May 6, 2026
4 checks passed
@zirkelc zirkelc deleted the feat/450_athena-iam branch May 6, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate Athena States

2 participants