Create IAM user
First, create a IAM user
Click Access management/Users
Click Add user
Add user
Fill in User name
Access type: Programmatic access
Set permissions
Select Attach existing policies directly
Select AdministratorAccess
Set permissions boundary / Create user without a permissions boundary
Add tags (optional)
Skip it
Review
Confirm the information is correct
Success
Download the CSV
AWS CLI
Install AWS CLI
Next, install AWS CLI
- Windows 64 bit (default C:\Program Files\Amazon\AWSCLIV2)
- Others
Run CMD
Enter aws --version
to check information
Configuration
Input aws configure
, check the CSV file, Enter the following in order
- AWS Access Key ID (The string that only contain uppercase characters)
- AWS Secret Access Key (The longest string)
- Default region name (
ap-northeast-1
(Tokyo) or others) - Default output format (
json
)
You can use AWS CLI now.
Basic
Use command aws s3
interact with S3
s3 mb
Create Bucket
|
|
s3 ls
list bucket name or files and folders in bucket
|
|
s3 rb
delete bucket
|
|
Others s3 cp
γs3 mv
γs3 rm
γs3 sync
Similar with Windows and Linux commands
Use it
Use AWS CLI to upload
Use s3 sync
command to sync
Any file with the same file name as the destination file but with a different file size or modification time will be updated.
|
|
Canonical User ID
can find from My security Credentials
/Account identifiers
Just one line, it can replace a series of actions of opening a browser, logging into AWS, and uploading files to S3.
Not over yet, write it as Batch file
Copy and paste the new file below and change the variables LOCAL
γBUCKET
γAWS_ID
Save as a new file with the extension .bat
|
|
Just execute this Batch file in the future.
Done