How to make AWS aurora Mysql into a writable instance - amazon-web-services

I am working on a project where we are creating a new region for resilience purpose.
As we create a new Region for the project, we also plan to create a Read replica of Aurora MySQL DB.
My question here has two parts
If the project in existing region goes down, how to make the read replica of Aurora MySQL in the other region as the new Master and writable?
I searched through few videos and stackoverflow questions and I do understand how to make the RDS mysql as writable instance. but, I don't see how to make such a "read-only" parameter modification in Aurora MySQL!
How could I do this change with a Jenkins Job?
Any help is highly appreciated!
Thanks!

You can use the AWS CLI for this, specifically the:
aws rds promote-read-replica-db-cluster
command which contrary to the name actually applies to Aurora as stated in the documentation for the command:
Note:
This action only applies to Aurora DB clusters.
You can find more information in the AWS documentation for Aurora, specifically the section on Promoting a Read Replica to Be a DB Cluster.
Seems like you should be able to use the Jenkins AWS plugin but there are many options.

Related

How can I migrate an RDS serverless cluster to a provisioned

I know the question is normally the other way around, but it seems important to know how can we go back to a provisioned solution from a serverless cluster.
We will migrate to an Postgres RDS serverless cluster in a few days and we would like to know how can we go back to a provisioned cluster if something goes wrong with the serverless solution. I didn't find any answers, as DMS doesn't seem to allow serverless sources.
Is there any way to achieve this, other than using pg_dump?
Thank you!
It depends on the version of AWS RDS Aurora Serverless that you are using:
For Serverless v1, just create a snapshot and restore it to a provisioned cluster. Snapshots are compatible between provisioned clusters and Serverless v1.
Serverless v2 uses the same clusters as provisioned instances (see the first paragraph of the AWS Docs for Serverless v2). Select the serverless instance of the cluster, click the "Modify" button and select another "DB instance class" under "Instance configuration". Note: You can also have serverless and provisioned instances in the same cluster, which allows for more complex migration paths like first adding a new instance, remove the old one and using writer instance promotion.
You may first want to test those methods with test data even though I validated them for you with empty databases.
Please also keep in mind that Severless v2 only released in April 2022 (after a long beta testing period solely with MySQL), so you may want to thoroughly test it if you want to use it in production.

Can we use AWS Data Migration Service for replication from Aurora Serverless as source?

My DMS replication instance (which is in same VPC as of Aurora serverless DB instance) is not able to find DB while creating endpoint in DMS.
However, I am able to create a cloud9 instance in same VPC as aurora serverless instance and connect to it from there.
Am I missing something here or it is not possible to use AWS DMS for migrating data from Aurora serverless as source?
Above issue was resolved by explicitly specifying the connection details for aurora serverless cluster (instead of dropdown selection). But the answer to original question of using Aurora serverless DB as source in DMS replication -
Yes, if only one time replication is required
No, If ongoing replication is required. For ongoing replication, It is required to change the values of binlog_format parameter for source database. Although, Aurora serverless allows changing value for this parameter but it has no impact in actual. Only a few parameters are supported for change which are listed here

Cloning one of the Database in AWS RDS in order to get a test DB

I am quiet new to AWS and trying to learn things. I currently have a live production environment and trying to create a test environment. I was able to create an image of an ec2 instance in AWS using the 'Create Image' option in the 'Actions'. Now I am trying to create an image/ duplicate of the RDS Database in AWS in a similar way. Is there any easy way to clone the database so that I don't change any data in the original database and perform modifications only in the test database. Thanks for all your help.
Probably worth reading up on creating snapshots and restoring from a snapshot.
To give you a quick summary; you will take a snapshot of your production RDS DB instance. Then you will launch a new DB instance from this snapshot.
As long as you don't need to launch the new instance in a separate AWS Account, the documentation should tell you all you need to know.

How to use AWS DMS from a region to an other?

I am trying to use AWS DMS to move data from a source database ( AWS RDS MySQL ) in the Paris region ( eu-west-3 ) to a target database ( AWS Redshift ) in the Ireland region ( eu-west-1 ). The goal is to continuously replicate ongoing changes.
I am running into these kind of errors :
An error occurred (InvalidResourceStateFault) when calling the CreateEndpoint operation: The redshift cluster datawarehouse needs to be in the same region as the current region. The cluster's region is eu-west-1 and the current region is eu-west-3.
The documentation says :
The only requirement to use AWS DMS is that one of your endpoints must
be on an AWS service.
So what I am trying to do should be possible. In practice, it's seems it's not allowed.
How to use AWS DMS from a region to an other ?
In what region, should my endpoints be ?
In what region, should my replication task be ?
My replication instance has to be on the same region than the RDS MySQL instance because they need to share a subnet
AWS provides this whitepaper called "Migrating AWS Resources to a New AWS Region", updated last year. You may want to contact their support, but an idea would be to move your RDS to another RDS in the proper region, before migrating to Redshift. In the whitepaper, they provide an alternative way to migrate RDS (without DMS, if you don't want to use it for some reason):
Stop all transactions or take a snapshot (however, changes after this point in time are lost and might need to be reapplied to the
target Amazon RDS DB instance).
Using a temporary EC2 instance, dump all data from Amazon RDS to a file:
For MySQL, make use of the mysqldump tool. You might want to
compress this dump (see bzip or gzip).
For MS SQL, use the bcp
utility to export data from the Amazon RDS SQL DB instance into files.
You can use the SQL Server Generate and Publish Scripts Wizard to
create scripts for an entire database or for just selected objects.36
Note: Amazon RDS does not support Microsoft SQL Server backup file
restores.
For Oracle, use the Oracle Export/Import utility or the
Data Pump feature (see
http://aws.amazon.com/articles/AmazonRDS/4173109646282306).
For
PostgreSQL, you can use the pg_dump command to export data.
Copy this data to an instance in the target region using standard tools such as CP, FTP, or Rsync.
Start a new Amazon RDS DB instance in the target region, using the new Amazon RDS security group.
Import the saved data.
Verify that the database is active and your data is present.
Delete the old Amazon RDS DB instance in the source region
I found a work around that I am currently testing.
I declare "Postgres" as the engine type for the Redshift cluster. It tricks AWS DMS into thinking it's an external database and AWS DMS no longer checks for regions.
I think it will result in degraded performance, because DMS will probably feed data to Redshift using INSERTs instead of the COPY command.
Currently Redshift has to be in the same region as the replication instance.
The Amazon Redshift cluster must be in the same AWS account and the
same AWS Region as the replication instance.
https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Redshift.html
So one should create the replication instance in the Redshift region inside a VPC
Then use VPC peering to enable the replication instance to connect to the VPC of the MySQL instance in the other region
https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html

Documentation on AWS RDS "migrate snapshot"

I can't seem to find much information about the "migrate snapshot" option in the AWS/RDS documentation.
Is it correct to assume that it creates a new, totally separate database based on that snapshot and leaves the original database intact?
The Migrate Snapshot function spins up a new Aurora DB Cluster from a MySQL DB snapshot.
The Migrate Snapshot button in AWS Web Console is currently active only for MySQL snapshots. Naming and appearance of the button is unfortunate. It would probably be more intuitive to only show that button for when a MySQL snapshot is selected and name it as Restore to Aurora or Launch Aurora Cluster.
You can find more information about that function in the AWS RDS user guide under Migrating an RDS MySQL Snapshot to Aurora subsection of the Aurora on Amazon RDS section.
Yes, if you spin up an instance from an RDS snapshot, it creates a completely new instance and leaves the original intact.