Great! Thank you.
RDS Proxy for Aurora Serverless v2
Even though AWS officially supports RDS Proxy for Aurora Serverless v2 (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/rds-proxy.html#rds-proxy.limitations), Laravel Vapor doesn't.
Here's an answer I got from Laravel Vapor support team (Josh C.): "I'm afraid Vapor doesn't have support for proxies on Serverless v2 so if this is something you require, you will need to configure it manually at this time.". I suggested adding this to vapor docs as they are currently incorrect (https://docs.vapor.build/resources/databases.html#database-proxies - Limitations part says: "Before considering the usage of database proxies in Vapor, please consult Amazon's list of limitations.") where Amazon limitations clearly say that RDS Proxy is available for Aurora Serverless v2, but they didn't do it.
So if anyone needs this, it is doable by creating RDS Proxy manually. Here are few tips to make it work:
-
Remove
database: db-namefrom vapor.yml -
Create new Secret in AWS Secrets Manager
- type: Credentials for RDS database
- username and password are the ones you use for connecting to DB (vapor / password)
- encryption key should be aws/secretsmanager
- in database select the one you want to use proxy for (same one you provided username/password from and removed from vapor.yml)
-
Create new RDS proxy
- for IAM role select
laravel-vapor-role(same role used for everything else) - for Secrets use the one created in step 2
- select require Transport Layer Security
- everything else stays default
- for IAM role select
-
Wait until Proxy is provisioned (it takes 10+ minutes and it is not fully available even if it says it is, you need to wait a bit more), check it out and take newly created endpoint url (read/write one)
-
Go to vapor and edit environment variables
DB_HOST=rds-proxy-url-you-got-on-step-4
DB_PORT=3306
DB_DATABASE=vapor
DB_USERNAME=db-username-you-provided-on-step-2
DB_PASSWORD=db-password-you-provided-on-step-2
Finally, deploy app which should remove database: db from vapor yml and use DB connection provided in step 5
Good luck!
Please or to participate in this conversation.