How to Sync AWS S3 Files using AWS CLI: คู่มือทีละขั้นตอน.
How it to do manually:
1. Log into the AWS console, navigate to S3 Service;
2. Find the right bucket, find the right folder;
3. Open the first file, click download;
4. Go back, and open the next file, over and over again.
With AWS CLI, that entire process took less:
aws s3 sync s3://<bucket>/<path> </local/path>
สารละลาย
1. Install the AWS CLI
Download AWS Client (I`m using v1) ที่นี่.
บันทึก: You can also download it and use it on macOS or Linux systems.
2. Get your access keys
Before using AWS Client we must obtain access keys (this is need for feature client configuration)
1. Log into the IAM Console;
2. ไปที่ ผู้ใช้.;
3. Click on your user name;
4. ไปที่ Security credentials แท็บ;
5. คลิก Create access key (you can create only two keys for one user account);
6. You’ll see your Access key ID. คลิก Show to see your Secret access key.
บันทึก: Amazon will show this secret access key only once. ถ้าคุณทำมันหาย – คุณต้องได้รับรหัสใหม่.
3. Configure AWS CLI
1. วิ่ง aws configure
และตอบคำถาม.
2. ในการวิ่งครั้งแรกของ aws configure
คุณจะเห็น [None]
;
3. ในอนาคต คุณสามารถเปลี่ยนค่าเหล่านี้ได้โดยเรียกใช้ aws cli
อีกครั้ง;
4. ข้อความแจ้งจะมีลักษณะดังนี้ AWS Access Key ID [****************ABCD]
, และคุณจะสามารถรักษาค่าที่กำหนดได้โดยการกด return.
$ aws configure
AWS Access Key ID [None]: <enter the access key you just created>
AWS Secret Access Key [None]: <enter the secret access key you just created>
Default region name [None]: <enter region - valid options are listed below >
Default output format [None]: <format - valid options are listed below >
- ชื่อภูมิภาคที่ถูกต้อง (บันทึกไว้ที่นี่) เป็น ชื่อภูมิภาค:
- ap-ภาคตะวันออกเฉียงเหนือ-1 [ในภูมิภาคเอเชียแปซิฟิก (โตเกียว)]
- ap-ภาคตะวันออกเฉียงเหนือ-2 [ในภูมิภาคเอเชียแปซิฟิก (โซล)]
- ap-ใต้-1 เอเชีย [แปซิฟิก (มุมไบ)]
- ap-ตะวันออกเฉียงใต้-1 [ในภูมิภาคเอเชียแปซิฟิก (สิงคโปร์)]
- ap-ตะวันออกเฉียงใต้-2 [ในภูมิภาคเอเชียแปซิฟิก (ซิดนีย์)]
- ca-กลาง-1 [แคนาดา (ศูนย์กลาง)]
- eu-central-1 [อียูกลาง (แฟรงค์เฟิร์ต)]
- eu-west-1 [สหรัฐอเมริกาตะวันตก (ไอร์แลนด์)]
- eu-west-2 [สหรัฐอเมริกาตะวันตก (ลอนดอน)]
- คุณ-ตะวันออก-1 [อเมริกาใต้ (เซาเปาโล)]
- เรา-ตะวันออก-1 [สหรัฐอเมริกาตะวันออก (เวอร์จิเนีย)]
- เรา-ตะวันออก-2 [สหรัฐอเมริกาตะวันออก (โอไฮโอ)]
- เรา-ตะวันตก-1 [สหรัฐอเมริกาตะวันตก (เอ็น. แคลิฟอร์เนีย)]
- เรา-ตะวันตก-2 [สหรัฐอเมริกาตะวันตก (โอเรกอน)]
- รูปแบบเอาต์พุตที่ถูกต้อง เป็น
- เจสัน
- โต๊ะ
- ข้อความ
4. Use AWS CLI!
สั่งการ sync
คัดลอกไฟล์ใหม่และไฟล์ที่อัปเดตซ้ำจากไดเร็กทอรีต้นทางไปยังปลายทาง. สร้างเฉพาะโฟลเดอร์ในปลายทางหากมีไฟล์ตั้งแต่หนึ่งไฟล์ขึ้นไป. ขณะนี้เราสามารถดาวน์โหลดชุดรูปภาพทั้งหมดได้ง่ายๆ
aws s3 sync s3://cdn.enterinit.com/photos/ ~/d:\AWS