Skip to content

Instantly share code, notes, and snippets.

@avinash-mishra
Forked from stevenyap/AWS-CLI.md
Last active September 10, 2018 08:02
Show Gist options
  • Save avinash-mishra/6b298a4fdc0d62cfffb5502875fdbcb5 to your computer and use it in GitHub Desktop.
Save avinash-mishra/6b298a4fdc0d62cfffb5502875fdbcb5 to your computer and use it in GitHub Desktop.
AWS S3 Command Line

S3 Syncing

# sync from bucket to local
aws s3 sync <bucket> <target_folder> <options>
aws s3 sync s3://mybucket . --acl public-read

aws s3 sync --region ap-northeast-1 s3://[移動元バケット名] s3://[移動先バケット名]


# sync from local to bucket
aws s3 sync <target_folder> <bucket>

Copying

aws s3 cp s3://stapi-us/production/ s3://stapi-us/development/ --recursive --acl public-read-write

Install AWS CLI

  • You need this for the receipe above
brew install python # installs python and pip
pip install awscli # installs aws
aws configure

# Now you can use aws cli
# If you encounter any error, see this: https://github.com/dotcloud/dotcloud-cli/issues/23
# ダウンロード
aws s3 cp --region ap-northeast-1 s3://[移動元バケット名]/ . --recursive

# アップロード
aws s3 cp --region ap-northeast-1 hoge s3://[移動先バケット名]/  --recursive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment