How to transfer AWS RDS to different role - amazon-web-services

We have two AWS roles/accounts, and I hosted our PostgreSQL in one account, and later I was notified this role would be disabled shortly, and I need to transfer our database to another AWS accounts. So I made a snapshot of the DB from one to another. I'm wondering if the original account is deleted in the future, does my snapshot also get impacted? Thanks for the clarification

I agree with #erik258. I am sharing this article that says you can't transfer resources between accounts. However, you can migrate Amazon RDS resources to another account.
To migrate Amazon RDS resources to another account, follow these instructions:
Create a DB snapshot.
Share the snapshot with the target account.
Create a new DB instance in the target account by restoring the DB snapshot.

Related

AWS EC2 AMI and RDS snapshot copy

I want to copy(not share) EC2 AMI and RDS snapshot from one account to another account.
I also want to automate this process.
Help will appreciated.
The process would need to be:
Share the snapshot with the other AWS Account
From the other account, trigger a copy operation on the AMI / RDS Snapshot
The 'share' step is required to grant access to the other AWS Account.
You could automate this with code, but the code would need the ability to access both AWS Accounts since the 'share' step needs to be done in the source account and the 'copy' step needs to be done in the target account. This could be done by creating an IAM Role in the target account that can be assumed by your code.
You could potentially go one step further and have the code run in an AWS Lambda function that is automatically triggered by EventBridge whenever a new snapshot is generated. This can be done by triggering off an "RDS DB Snapshot Event", but I can't see an event that would trigger after an AMI is created.

Migrating data from live RDS database instance associated with one AWS account to a new RDS database instance associated with another AWS account

I am working with a Sprint boot application hosted on AWS. Application data gets stored in AWS RDS. Now I have set up another AWS account where I would like to migrate the data from the RDS instance associated with the current AWS account.
In this regard, after going through several posts here, it seems, the steps to do the same are as follows:
1. Create a snapshot of the database in the RDS database instance associated with the current AWS account.
2. Share the snapshot with the new AWS account.
3. Import the data from this snapshot to the RDS instance associated with the new AWS account.
One problem with this approach is: I have to make the application unavailable to the end-users until all the steps are completed as well as the application with the database hosted in the new AWS account starts running, otherwise there will be always some delta remaining to be migrated.
But, I would like to migrate the data from an existing instance to the new instance without making the application unavailable to end-users, I did not find any suitable approach to achieve the same.
Could anyone please help here? Thanks.
create a read replica
stop slave in read replica using stop MySQL.rds_stop_replication
capture mysql_binary_log_file_name,mysql_binary_log_file_location
stop instance
take snapshot
restore in another AWS account
create replication user name in master
run below command in newly created RDS with required values
CALL mysql.rds_set_external_master (
host_name
, host_port
, replication_user_name
, replication_user_password
, mysql_binary_log_file_name
, mysql_binary_log_file_location
);
move connection and plan cut over properly
Good article on how to setup cross-account replication:
https://aws.amazon.com/premiumsupport/knowledge-center/rds-mysql-cross-region-replica/
Another way is using AWS Database Migration Services (AWS DMS).
You can create a migration task, and set the original database as the source endpoint, and the new database as a destination endpoint.
Next create a task with "Full load, ongoing replication" settings.
Some caveats: make sure to enable replication on the source database and it uses RAW bin log format for MySQL/MariaDB. More details here: https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.MySQL.html
It also damaged the destination tables structure in my case.

How to copy redshift cluster snapshot from one account to another account through script

How to copy a redshift cluster snapshot from one account to another account through script.
To manually migrate an Amazon Redshift cluster to another AWS account, follow these steps:
Create a manual snapshot of the cluster you want to migrate.
Share the cluster snapshot with another AWS account to view and
restore the snapshot.
Before you copy a snapshot to another region, first enable
cross-region snapshots.
In the destination AWS account, restore the shared cluster snapshot.
Please see
https://aws.amazon.com/premiumsupport/knowledge-center/account-transfer-redshift/
If you want to do that in a "script" for some reason - then you need to read https://docs.aws.amazon.com/redshift/latest/mgmt/manage-snapshots-api-cli.html
I believe everything you need can be done using aws cli.

AWS EC2 AMI and RDS Snapshot sharing

We are currently migrating our AWS infrastructure into another AWS Account,
To do so, I created AMIs of my EC2 instances which I need to redeploy in the newer AWS account,
Similarly I took Snapshot of the RDS which I will be needing.
I shared the AMIs and the RDS with the new AWS Account Number.
What I am worried about is,
When the old account is cleaned and shut down,
will my shared AMIs and Snapshots get removed from the new account as well?
Yes, they will go away and be inaccessible from the new account, since they will no longer exist.
Sharing only gives the remote account permission to access the resource. It doesn't copy or clone them.
From the new account, you need to make a copy of the shared AMIs and shared DB Snapshots if you want them to be permanently available.

Move AWS EC2 Instance to another account

I created a Amazon AWS EC2 instance under my account and made an website/ftp on it, now a new partner wants to move the instance under his company account so his company can pay the bills.
We can't change the instance IP because banks in the region are communicating with the server.
How can I move the instance to a different account without having to change anything on the configuration?
The short answer is: No, you cannot move an running instance from one account to another unless and ofcourse AWS Technical support has some magic available behind the curtains.
You can However, Create an AMI from this instance and share this AMI with other users/account. refer: http://aws.amazon.com/articles/530
To share or migrate EC2 instances from a source account to a target
account follow these steps:
Create a custom Amazon Machine Image (AMI)
from the instance you want to share or migrate. Be sure to include all
required EBS data volumes in the AMI.
Note: Data stored on instance store volumes isn't preserved in AMIs, and won't be on the instance store volumes of the instances
that you launch from the AMI.
Share the AMI with the target account
using either the EC2 console or the AWS Command Line Interface (CLI).
From the target account, find the AMI
using the EC2 console or the AWS CLI.
Launch a new instance from the shared AMI
on the target account.
Note: The private IP address of VPC instances will be different in the new account, unless you specifically set them during
launch.
Related information
Changing the Encryption State of Your Data
AWS CLI Command Reference (EC2)
Source: Transfer Amazon EC2 Instance
This is not possible.
AWS Support does not have access to copy Amazon EC2 resources or
manipulate any configuration options in AWS accounts. You can't
separate an AWS account from an Amazon.com account or transfer
resources between AWS accounts. It is possible to manually migrate
Amazon EC2 resources from one account to another by completing the
steps described here.
Source : https://aws.amazon.com/premiumsupport/knowledge-center/account-transfer-ec2-instance/
I'm working with several hundreds on EC2 instances in several AWS regions and accounts. You can move an EC2 instance to another AWS account, however, you can't move the Elastic IP and it will take up 16 steps with AWS CLI, if you want to migrate Tags and clone the Security Groups. I wrote a detailed post with the whole process at https://medium.com/#gmusumeci/how-to-move-an-ec2-instance-to-another-aws-account-e5a8f04cef21.
there are more than 10 steps involved in doing the cloud move. I would suggest you use Infrastructure as a Configuration (terraform and CloudFormation) or Infrastructure as a real code (pulumi and CDK)
however if you want to give a go at a nice tool I found called KopiCloud. Please feel welcome to try it and leave your comments below. Is good if you need to move instances on a quick lift and shift scenario.
You can re-think the design of having the banks in the region communicating to your servers via IP.
If the banks communicate using DNS names, you have much more flexibility to move your servers around.
You can also achieve improvements in high availability and resiliency by moving to DNS connections.
So a plan might be
Setup a DNS record for your existing server
Get the banks who connect to your server to connect via the DNS name
Setup your new server in the other account (other answers describe this)
Cut the banks over to your new server in the new account simply by updating the DNS record
I haven't tried load balancing across accounts, but that may be another option, which would give you HA as a bonus. By registering your current instance, and new instance in another account as targets with a load balancer and getting your clients to connect to the load balancer, you could cut over to the other account. The only part I haven't tried is registering targets in different accounts, but looks like this should be possible with an AWS Network Load Balancer