Skip to content

aws dsql generates invalid tokens instead of erroring when credentials are missing #9966

@dhunganabibek

Description

@dhunganabibek

Describe the bug

Issue: aws dsql generates invalid tokens instead of erroring when credentials are missing

Description
The aws dsql command silently fails by generating a token (which is functionally invalid) when the default AWS profile is unset. Standard commands (like s3) correctly raise an error immediately.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

The DSQL command should validate credentials and raise an error (e.g., InvalidAccessKeyId or ProfileNotFound) instead of outputting a silent, useless token. This ensures users are aware their authentication has failed before they attempt to use the invalid token.

Current Behavior

Provide an invalid token that does not work.

Reproduction Steps

Reproduction Steps

  1. Ensure the default AWS profile or environment variables are unset.

Command 1: S3 (Expected Behavior)

aws s3 ls

Output:
An error occurred (InvalidAccessKeyId) when calling the ListBuckets operation...

Command 2: DSQL (Confusing Behavior) in macOS: 26.2 (have not checked in Windows or Linux)*

aws dsql generate-db-connect-admin-auth-token --expire 3600 --hostname example.dsql.us-east-1.on.aws

Output:
Returns a token string (It gives a token, but does not work)

I know if you use --profile <profile_name>, it works. It's just super confusing when you forget to set up the default profile.

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.28.21 Python/3.13.7 Darwin/25.2.0 exe/x86_64

Environment details (OS name and version, etc.)

macOS: 26.2

Metadata

Metadata

Labels

aurora-dsqlbugThis issue is a bug.p2This is a standard priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions