Amazon Aurora DSQL is provided as a Preview service.
To learn more, see Betas and Previews
Once your cluster is ACTIVE
, you can generate an authentication token.
There are two ways to generate the token
-
If you are connecting as
admin
user, you use thegenerate_db_connect_admin_auth_token
-
If you are connecting with a custom database role, you use the
generate_db_connect_auth_token
The following example uses the following attributes to generate an authentication token for the admin role.
-
your_cluster_endpoint – endpoint of the cluster. Follows the format
your_cluster_identifier
.dsql.AWS_REGION
.on.aws -
region – The AWS Region, such as us-east-2 or us-east-1
require 'aws-sdk-dsql'
def generate_token(your_cluster_endpoint, region)
credentials = Aws::SharedCredentials.new()
begin
token_generator = Aws::DSQL::AuthTokenGenerator.new({
:credentials => credentials
})
# The token expiration time is optional, and the default value 900 seconds
# if you are not using admin role, use generate_db_connect_auth_token instead
token = token_generator.generate_db_connect_admin_auth_token({
:endpoint => your_cluster_endpoint,
:region => region
})
rescue => error
puts error.full_message
end
end