Member-only story
How I automated uploading local files to AWS S3 bucket
I have a lot of files in my local machine that need to be uploaded to AWS S3 bucket. The files are stored in subdirectories within directories in my local machine. I have the same pattern of subdirectories and directories on the S3 bucket.
Instead of manually going through each subdirectory and directory and upload the files one by one, we can write a script to do that for us.
Here are the steps to implement this:
Download and install AWS CLI to your local machine. Follow the steps at AWS documentation.
Connect to your AWS account from your CLI. Once
aws cli -v
returns a version number, you are all set with AWS CLI installation. Now you have to connect to your AWS account. You will need AWS account access key ID and secret access key. You can find them from AWS account console. If necessary, generate new key and secret. If you are not an admin, most likely you do not have access to them. Ask your administrator to vie you access key ID and secret access key. Then type
aws configure
on the CLI. It will prompt you to enter AWS access key ID: paste your key ID. Next it will prompt you to enter AWS secret access key: paste your secret key. It will prompt you to enter default…