I'm trying to connect to my MySQL RDS from a Lambda via AWS.RDS.Signer with the following code and fake credentials:
1 const DB_REGION = 'ap-southeast-2a' 2 const DB_HOST = 'dbinstance.ddtev8utygt.ap-southeast-2.rds.amazonaws.com' 3 const DB_PORT = 3306 4 const DB_USER = 'anyuser' 5 const DB_NAME = 'anydb' 6 7 const signerOptions = { 8 region: DB_REGION, 9 hostname: DB_HOST, 10 port: DB_PORT, 11 username: DB_USER 12 } 13 14 const signer = new AWS.RDS.Signer(signerOptions) 15 const token = await signer.getAuthToken() 16 17 const config = { 18 host: DB_HOST, 19 user: DB_USER, 20 password: token, // "Password123" 21 database: DB_NAME, 22 ssl: 'Amazon RDS', 23 authPlugins: { 24 mysql_clear_password: () => () => token 25 } 26 } but I always get this error
"Access denied for user 'anyuser'@'172.14.1.12' (using password: NO)" I'm not entirely sure if that is needed for the AWS.RDS.Signer but I selected this option of my database:
Password and IAM database authentication Authenticates using the database password and user credentials through AWS IAM users and roles. NOTE: If I swap the password from token to "Password123" on line 20 I can successfully connect to my RDS.
Am I missing something here or does AWS.RDS.Signer only work with RDS Proxy?
By the way: the getAuthToken function gives me something like that (token truncated)
没有评论:
发表评论