Repository navigation
Support assume-role for Glue and DynamoDB catalogs - #4132
Open
David-Banquet wants to merge 2 commits into
Open
David-Banquet wants to merge 2 commits into
David-Banquet wants to merge 2 commits into
Conversation
Extend the existing S3 FileIO assume-role mechanism (client.role-arn / client.role-session-name) to the boto3 sessions built by GlueCatalog and DynamoDbCatalog. When a role ARN is configured, an STS AssumeRole is performed from the base session and the resulting temporary credentials are used for the Glue/DynamoDB client. Role configuration follows the same precedence already used for the other client.* properties: a service-prefixed override (glue.role-arn / dynamodb.role-arn, glue.role-session-name / dynamodb.role-session-name) falls back to the unified client.role-arn / client.role-session-name. Default behavior (no role ARN configured) is unchanged. Closes apache#2747 Signed-off-by: lemon0333 <147061193+lemon0333@users.noreply.github.com>
The catalog session was built from the static credentials of a single AssumeRole call, so a long-lived catalog failed with ExpiredToken once the role session ended (one hour by default). Use botocore's AssumeRoleCredentialFetcher with DeferredRefreshableCredentials: the role is assumed on first use and again before the credentials expire. Co-authored-by: lemon0333 <147061193+lemon0333@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fokko
reviewed
Oct 22, 2026
Fokko
left a comment
Contributor
There was a problem hiding this comment.
Thanks for adding this @David-Banquet I've left a small comment
| | client.role-session-name | session | An optional identifier for the assumed role session. | | ||
| | client.role-arn | arn:aws:... | AWS Role ARN. If provided instead of access_key and secret_key, temporary credentials will be fetched by assuming this role. | | ||
| | client.role-session-name | session | An optional identifier for the assumed role session used to access both the Glue/DynamoDB Catalog and the S3 FileIO. | | ||
| | client.role-arn | arn:aws:... | AWS Role ARN. If provided instead of access_key and secret_key, temporary credentials will be fetched by assuming this role before accessing both the Glue/DynamoDB Catalog and the S3 FileIO. | |
Contributor
There was a problem hiding this comment.
The order is different here. Can we first do arn, and then role-session-name?
I've checked against the Java implementation, and there we use client.assume-role.arn and client.assume-role.session-name. Can we use the same keys here? This way when this information is supplied through a catalog, then it works for both.
This branch has not been deployed
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 #2747
Rationale for this change
This picks up #3838 by @lemon0333, which was closed for inactivity before anyone reviewed it (see my comment there). Their commit is kept as is, with them as author.
client.role-arn/client.role-session-nameare honored by the S3 FileIO but ignored by the Glue and DynamoDB catalogs, which build their ownboto3.Session. #3838 extends them to both catalogs, with service-prefixed overrides (glue.role-arn,dynamodb.role-arn, and the matching*-role-session-name) falling back to theclient.*ones, like the other session properties.The second commit changes one thing: #3838 built the catalog session from the static credentials of a single
AssumeRolecall, so a long-lived catalog started failing withExpiredTokenonce the role session ended (one hour by default). The session now uses botocore'sAssumeRoleCredentialFetcherwithDeferredRefreshableCredentials: the role is assumed on first use and again before the credentials expire, the same way botocore handlesrole_arnin an AWS profile.Are these changes tested?
Yes, with
moto:Are there any user-facing changes?
Yes: the Glue and DynamoDB catalogs now honor
client.role-arn/client.role-session-name, plus the newglue.role-arn,glue.role-session-name,dynamodb.role-arnanddynamodb.role-session-name. Documented inconfiguration.md. Nothing changes when no role ARN is set.🤖 Generated with Claude Code