You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go to the downloaded directory and extract the files
unzipawscliv2.zip
Now, run the installation file
sudo ./aws/install
This will install the AWS CLI 2 in your system.
To verify the installation, use
aws --version
Configure Account
To configure your account
aws configure
Now insert the access key id, secret access key, default region name, your desired output format.
This should configure the CLI with your account credentials.
You can test the configuration by invoking the following commands
awss3ls
This should return all the buckets of your region.
Upload Files and Folders
If you do not have a S3 bucket create one.
Upload a Single File
To upload a single file we use the following
awss3cplocal_file_paths3://bucket_name/
Here the local_file_path stands for the local file path we are uploading from our local machine.
The bucket_name stands for our desired cloud S3 Bucket Name.
Upload files and folders to S3 Buckets from Ubuntu 20.04 using AWS CLI 2
Jan 10, 2021
2 min read
https://bmshamsnahid.medium.com/upload-files-and-folder-to-s3-from-ubuntu-20-04-using-aws-cli-2-2dd44f544809
By Shams Nahid
https://github.com/coding-to-music/aws-s3-copy-instructions
Applicable for Ubuntu 20.04 and its derivatives.
Creating a IAM User
To make any API call to AWS, we need a IAM user with appropriate permissions. According to the your purpose, create a IAM user and get the followings
You can download a csv file with these information provided by the AWS after creation of IAM user.
Install AWS CLI in Local Machine
Install AWS CLI
Install curl if it is not install in your machine. Also, you can use wget the default and preinstalled download manager for Ubuntu.
Download the AWS installation file
Go to the downloaded directory and extract the files
Now, run the installation file
This will install the AWS CLI 2 in your system.
To verify the installation, use
Configure Account
To configure your account
aws configure
Now insert the access key id, secret access key, default region name, your desired output format.
This should configure the CLI with your account credentials.
You can test the configuration by invoking the following commands
This should return all the buckets of your region.
Upload Files and Folders
If you do not have a S3 bucket create one.
Upload a Single File
To upload a single file we use the following
Here the local_file_path stands for the local file path we are uploading from our local machine.
The bucket_name stands for our desired cloud S3 Bucket Name.
Example:
This will upload a file named data.json to a bucket named test_bucket.
Upload All Files and Folder Recursively
To upload a folder along with all its files and folders, we can do the followings,
Here local_folder_path is the folder we are uploading.
The bucket_name is the desired cloud S3 bucket.
Example:
Here we are uploading a folder named build to the bucket named test_bucket.
Reference
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html
The text was updated successfully, but these errors were encountered: