AgentSkillsCN

aws-cli-s3

在使用AWS S3命令时——存储桶、对象、存储类别、生命周期规则、版本控制、网站托管、预签名URL、分段上传。在创建或管理S3存储桶、上传/下载/复制/同步对象、配置存储桶策略与访问点、设置生命周期规则、启用版本控制、配置静态网站托管、生成预签名URL、管理分段上传、设置跨区域复制,或配置服务器端加密时使用此技能。

SKILL.md
--- frontmatter
name: aws-cli-s3
description: Use when working with AWS S3 commands — buckets, objects, storage classes, lifecycle rules, versioning, website hosting, presigned URLs, multipart uploads. Use this skill when creating or managing S3 buckets, uploading/downloading/copying/syncing objects, configuring bucket policies and access points, setting up lifecycle rules, enabling versioning, configuring static website hosting, generating presigned URLs, managing multipart uploads, setting up cross-region replication, or configuring server-side encryption.

AWS CLI v2 — S3 (Simple Storage Service)

Overview

Complete reference for aws s3 (high-level) and aws s3api (low-level) subcommands in AWS CLI v2. Covers bucket management, object operations, storage classes, lifecycle rules, versioning, access policies, encryption, website hosting, and transfer acceleration.

Quick Reference — Common Workflows

Create bucket and upload

bash
aws s3 mb s3://my-bucket --region us-east-1
aws s3 cp local-file.txt s3://my-bucket/path/
aws s3 sync ./local-dir s3://my-bucket/prefix/ --delete

Download and list objects

bash
aws s3 ls s3://my-bucket/prefix/ --recursive
aws s3 cp s3://my-bucket/path/file.txt ./local-file.txt
aws s3 sync s3://my-bucket/prefix/ ./local-dir

Generate presigned URL

bash
aws s3 presign s3://my-bucket/path/file.txt --expires-in 3600

Set bucket policy

bash
aws s3api put-bucket-policy --bucket my-bucket --policy file://policy.json

Enable versioning

bash
aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Enabled

Configure lifecycle rule

bash
aws s3api put-bucket-lifecycle-configuration --bucket my-bucket --lifecycle-configuration file://lifecycle.json

Covered Command Groups

GroupCommandsCLI Service
High-Levelcp, mv, rm, sync, ls, mb, rb, presign, websiteaws s3
Bucketscreate, delete, head, list, get/put policy, versioning, lifecycle, encryption, logging, cors, website, acl, replication, accelerate, taggingaws s3api
Objectsget, put, delete, copy, head, list-objects-v2, restore, select, presign, multipart uploadsaws s3api
Access Pointscreate, delete, get, list access points and policiesaws s3control

Command Reference

See references/index.md for the quick reference table and global options.

GroupFileCommands
High-Level Commands (aws s3)high-level-commands.mdcp, mv, rm, sync, ls, mb, rb, presign, website
Bucket Management (aws s3api)bucket-management.mdcreate-bucket, delete-bucket, head-bucket, list-buckets, get-bucket-location
Bucket Configurationbucket-configuration.mdput-bucket-policy, get-bucket-policy, delete-bucket-policy, get-bucket-policy-status, put-bucket-versioning, get-bucket-versioning, put-bucket-lifecycle-configuration, get-bucket-lifecycle-configuration, delete-bucket-lifecycle, put-bucket-encryption, get-bucket-encryption, delete-bucket-encryption, put-bucket-logging, get-bucket-logging, put-bucket-cors, get-bucket-cors, delete-bucket-cors, put-bucket-website, get-bucket-website, delete-bucket-website, put-bucket-acl, get-bucket-acl, put-bucket-replication, get-bucket-replication, delete-bucket-replication, put-bucket-tagging, get-bucket-tagging, delete-bucket-tagging, put-bucket-notification-configuration, get-bucket-notification-configuration, put-public-access-block, get-public-access-block, delete-public-access-block, put-bucket-accelerate-configuration, get-bucket-accelerate-configuration
Object Operationsobject-operations.mdput-object, get-object, delete-object, delete-objects, copy-object, head-object, list-objects-v2, list-object-versions, restore-object, get-object-acl, put-object-acl, get-object-tagging, put-object-tagging, delete-object-tagging, get-object-attributes
Multipart Uploadsmultipart-uploads.mdcreate-multipart-upload, upload-part, upload-part-copy, complete-multipart-upload, abort-multipart-upload, list-multipart-uploads, list-parts