Skip to content

Instantly share code, notes, and snippets.

@thisaurel
Last active June 28, 2020 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisaurel/b61ad7364424b806f6b08a98dbd8ad0a to your computer and use it in GitHub Desktop.
Save thisaurel/b61ad7364424b806f6b08a98dbd8ad0a to your computer and use it in GitHub Desktop.
Install aws cli
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html
Create IAM user with "AmazonS3FullAccess" policy and programming access ; then get the two keys (access and secret)
Configure aws cli with this command `aws configure`. Set the access, secret key and region and let output format empty
Command:
```bash
aws s3 mv s3://bucketfrom s3://bucketto --recursive --exclude "*" --include "*helloworld*" --include "*hello*" --include "*.png"
```
Useful commands:
```bash
# List all buckets
aws s3 ls
# List all objects in a bucket
aws s3 ls s3://<<bucket-name>>
aws s3 ls s3://mybucketname
# Create a s3 bucket
aws s3 mb s3://<<bucket-name>>
aws s3 mb s3://mybucketname --region eu-west-3
# Copy a file from your local folder to s3 bucket
aws s3 cp <<local filename>> s3://<<bucket-name>>/
aws s3 cp "LandingPage.cs" s3://mybucketname/
```
Sources and video
https://docs.aws.amazon.com/cli/latest/reference/s3/mv.html
https://aws.amazon.com/fr/premiumsupport/knowledge-center/s3-large-transfer-between-buckets/
https://www.youtube.com/watch?v=fIIQOXi6eEI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment