Skip to content

Amazon Athena Data Source Secrets Dropdown

0

When creating a database connection between Amazon Athena and an RDS database we are running in to an error where we are unable to see more than 10 Secrets in the Secrets dropdown.

Amazon Athena -> Data sources and catalogs -> Create data source

Section: **AWS Glue connection details - new **

Field:

AWS Secret Choose a secret from AWS Secrets Manager. AWS Glue will connect to data source using the keys of your secret. Make sure your Lambda execution role has access to it.

Clicking the drop down only returns 10 total Secrets. Oldest -> Newest.

It seems like a UI bug, is there a way to work around this utilizing the CLI?

1 Answer
0

It appears that the dropdown issue you're encountering in the Amazon Athena UI is likely related to a limit in the AWS Management Console when listing secrets from AWS Secrets Manager. This is a UI limitation, and the CLI should allow you to interact with AWS Secrets Manager without this restriction. You can work around this issue by using the AWS CLI to list the secrets and find the one you need.

Here's how you can list all the secrets using the AWS CLI and then use the secret ARN to configure your Athena connection:

    1. List all secrets with the AWS CLI:

You can use the aws secretsmanager list-secrets command to retrieve all secrets in your account, bypassing the 10-item UI limit.

aws secretsmanager list-secrets --query "SecretList[*].{Name:Name,ARN:ARN}" --output table This will return a table with the names and ARNs of all secrets, which you can use to find the appropriate one for your Athena connection.

    1. Create the Athena Data Source using the secret ARN:

After identifying the correct secret from the list, you can use its ARN to set up your Athena connection through the AWS Glue catalog. When configuring the connection via the CLI or SDK, you will provide the ARN of the secret instead of selecting it from the dropdown in the UI.

Example command to create a Glue connection using a secret ARN:

aws glue create-connection \ --connection-input '{"Name":"your-connection-name","ConnectionType":"JDBC","ConnectionProperties":{"PASSWORD":"arn:aws:secretsmanager:your-region:your-account-id:secret:your-secret-id"}}' Replace "your-connection-name" with the name of your connection and "arn:aws:secretsmanager:your-region:your-account-id:secret:your-secret-id" with the ARN of the secret you want to use.

    1. Grant Lambda execution role access to the secret:

Ensure that the Lambda execution role used by AWS Glue has permissions to access the secret from Secrets Manager. You can attach a policy to the Lambda role like this:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "secretsmanager:GetSecretValue", "Resource": "arn:aws:secretsmanager:your-region:your-account-id:secret:your-secret-id" } ] } By using the AWS CLI, you can bypass the UI limitations and provide the secret ARN directly for your Athena setup.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.