Today I was working for a scaleable solution in Aurora. Im going to publish that blog post soon in Searce Blog. As a part of this solution, I want to create Aurora read replicas programmatically. So we have done the create aurora read replica with AWS CLI and Lambda with Python. If you refer the AWS Doc, they mentioned there is no separate module for creating Aurora Read replica in boto3 or cli. Instead we can use create-db-instance. Many people may confused with this term. This blog will help them to create aurora read replicas using AWS CLI and Lambda.
If you are running this code via lambda then you can use the below policy.
- Lambda - Create a new role for lambda and attach inline policy
- EC2 Role - Create a new EC2 role and attach this policy and attach this Role to EC2.
- IAM User - If you are manually use IAM credentials for AWS CLI, attach the below policy to the IAM user.
Create Your Aurora Cluster:
First we need to create an Aurora cluster with 1 node. There are so many references for this. :) I leave this part to you.
- Cluster Name: bhuvi-aurora-replica-cluster
- Engine: aurora-mysql
- Engine Version: 5.7.12
- DB Parameter Group: default.aurora-mysql5.7
- Publicly accessible: Yes
- Storage Encrypt: No