Skip to content
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 2 commits into from Oct 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 51 additions & 0 deletions content/blog/2014-10_AWS_buckets_migration.md
@@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo. Should be 2.

Copy link
Member Author

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

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.
5 changes: 2 additions & 3 deletions layouts/authors/tukan.slim
Expand Up @@ -3,8 +3,7 @@ h2.about About Bartłomiej
markdown:
Bartłomiej is a partner at Nukomeet.

Read [all of Bartłomiej's posts][1], [follow him on Twitter][2] and check his [personal website][3].
Read [all of Bartłomiej's posts][1], [follow him on Twitter][2].

[1]: http://nukomeet.com/nulog/tukan/
[2]: http://twitter.com/tukan
[3]: http://
[2]: http://twitter.com/tukan2can