aws-s3-mv
Move objects between S3 locations
TLDR
Move a file from local to a specified bucket
Move a specific S3 object into another bucket
Move a specific S3 object into another bucket keeping the original name
Display help
SYNOPSIS
aws s3 mv SOURCE [SOURCE...] DESTINATION [options]
PARAMETERS
--recursive
Recurse on source directory or S3 prefix
--dryrun
Show what would be moved without executing
--exclude
Exclude files matching shell pattern (can repeat)
--include
Include files matching shell pattern (can repeat)
--acl
Canned ACL: private|public-read|etc.
--content-type
Set MIME content type for destination
--storage-class
Storage class: STANDARD|STANDARD_IA|ONEZONE_IA|INTELLIGENT_TIERING|GLACIER|etc.
--sse
Server-side encryption: AES256|AES128-KMS|aws:kms
--metadata-directive
COPY|REPLACE metadata on destination
--quiet
Suppress non-error output
--debug
Display debugging information
--no-progress
Disable progress meter
--follow-symlinks
Follow symlinks as directories (local sources only)
DESCRIPTION
The aws s3 mv command moves Amazon S3 objects and local files to new locations. It combines copy and delete operations: first copying the source to the destination, then deleting the source. This supports S3-to-S3, S3-to-local, local-to-S3, and local-to-local transfers.
It handles directories and buckets recursively with --recursive. Large files use multipart uploads/downloads for efficiency. Filters like --exclude and --include allow pattern-based selection. Metadata, ACLs, encryption, and storage classes can be set on the destination.
Unlike local mv, S3 moves incur API request costs and are not atomic, risking inconsistency if interrupted. Use --dryrun to preview operations. Requires AWS credentials configured via aws configure or environment variables.
CAVEATS
Not atomic in S3 (copy-then-delete); costs apply to operations; interruptions may leave duplicates. No true rename for S3 objects.
EXAMPLES
aws s3 mv s3://mybucket/foo.txt s3://mybucket/bar.txt
aws s3 mv s3://mybucket/dir/ s3://otherbucket/dir/ --recursive
aws s3 mv ./localfile s3://mybucket/ --storage-class STANDARD_IA
EXIT STATUS
0: success
1: general error
2: misuse of shell builtins or syntax error
HISTORY
Introduced in AWS CLI v1.7.0 (2014) as high-level S3 command; enhanced in v2.0+ (2020) with better performance and multipart handling.


