The Linux Server uploads files to S3 through the AWS command line
Purpose
The Linux Server uploads files to S3 through the AWS command line
Configuration
Open your AWS console;
Create a new user (such as test) in IAM. When it is created, it automatically creates a user security credential consisting of an "access key ID" and "Private access key, remember it and download the credential, which will be used later;
Select the user you just created and have an "Additional permission" under the "permission" tab. Click it, find a permission named "AmazonS3FullAccess" in the list, and check it, click "add permission ";
To connect to your Linux server, follow these steps.
# Installing pip
Yum-y install python-pip
# Installing awscli
Pip install awscli
# Initialization Configuration
Aws configure
# In this step, the system requires you to enter "access key ID", "Private access key", "Default region name", and "Default output format ", the first two are automatically generated when you create an IAM user. The "Default region name" is recommended to select the region where your EC2 instance is located. If you are not clear about the string corresponding to the region where your EC2 instance is located, refer to the link provided below. If you do not want to fill it out, it will automatically select the region closest to you. The "Default output format" can be in json or text format, the default format is json.
# Creating buckets
Aws s3 mb s3: // test20160307
# Upload a file to a bucket
Aws s3 cp/etc/my. cnf s3: // test20160307/
You can use the preceding steps to upload files to S3 through the AWS command line.
For more help information, see the AWS Official Website: http://docs.aws.amazon.com/zh_cn/cli/latest/userguide/cli-chap-welcome.html
For more information about AWS regions, see AWS Official Website: http://docs.aws.amazon.com/zh_cn/general/latest/gr/rande.html
This article permanently updates the link address: