New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: new article 2014-10_AWS_buckets_migration
#130
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
created_at: 2014-10-21 | ||
kind: article | ||
publish: true | ||
title: "Data migration between two Amazon S3 buckets on different accounts" | ||
authors: | ||
- tukan | ||
tags: | ||
- amazon | ||
--- | ||
|
||
Recently we needed to migrate data between two Amazon S3 buckets on different accounts. Situation seemed simple but while diving into topic we didn't find good documentation how to accomplish this. We tried few solutions but result one was that we had migrated data between buckets without proper rights on files so we couldn't do much with migrated data. | ||
|
||
Solution is to add proper policies on destination bucket and use `sync` on source bucket via AWS CLI. Here's how we did it in 2 steps: | ||
|
||
1. Create policy on destination bucket. | ||
Source bucket user needs to have access to destination bucket. You need to know source bucket account ID and source bucket user name (for user name you may use `root` if you don't want to use specific user). | ||
|
||
|
||
``` | ||
{ | ||
"Id": "Policy1357935677554", | ||
"Statement": | ||
[ | ||
{ | ||
"Sid": "Stmt1357935647218", | ||
"Action": "s3:*", | ||
"Effect": "Allow", | ||
"Resource": | ||
[ | ||
"arn:aws:s3:::destination-bucket-here", | ||
"arn:aws:s3:::destination-bucket-here/*" | ||
], | ||
"Principal": | ||
{ | ||
"AWS": "arn:aws:iam::account-number-here:user-name-here" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
1. Synchronise buckets via AWS CLI | ||
Make sure you have AWS CLI installed and set up with source bucket user credentials. Then you're ready to use `sync`. | ||
> A sync command makes it easy to synchronise the contents of a local folder with a copy in a S3 bucket. | ||
|
||
In our case we'll synchronise two S3 buckets on different accounts. | ||
|
||
``` | ||
aws s3 sync s3://source-bucket-name s3://destination-bucket-name --acl public-read | ||
``` | ||
In case you may need different parameters have a look at [sync](http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html) in AWS reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo. Should be
2
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AdrienGiboire I thnik it's ok to have 1, as it's markdown, so numbering is done via markdown