- Go to your RDS server and click on the proxy
- Copy the Proxy ARN
- Edit your serverless.yml and
provider:
name: aws
iam:
role:
statements:
- Effect: "Allow"
Action:
- "rds-db:connect"
Resource: "arn:aws:rds-db:us-east-1:123123123:admin:blah-123abc123abc/*"
Note that "rds" in the ARN was changed to "rds-db" and "db-proxy" in the ARN was changed to "admin" (the admin user of the database). sls deploy and check the lambda. You should see the proxy in the database proxy configuration section.
For example, the Proxy ARN I copied from RDS was
arn:aws:rds:us-east-1:123123123:db-proxy:blah-123abc123abc
and I edited it to be
arn:aws:rds-db:us-east-1:123123123:admin:blah-123abc123abc/*
Also, be sure your lambda is in the same Vpc as the RDS proxy or it will not be able to connect.
I am using:
% sls --version
Framework Core: 2.50.0
Plugin: 5.4.3
SDK: 4.2.3
Components: 3.13.2