Reading25 min read·Module 3

S3 Transfer Acceleration & Multipart Upload

Key concepts

  • Transfer Acceleration uses CloudFront

  • Multipart upload for large files

  • Byte-range fetches

  • S3 Select for query optimization

  • Presigned URLs

Overview

Amazon S3 provides several features to optimize data transfer performance, particularly for large files and geographically distributed users. Understanding these features is essential for designing high-performing architectures that minimize latency and maximize throughput.

This topic covers five key performance optimization techniques: Transfer Acceleration for global uploads, Multipart Upload for large files, Byte-Range Fetches for parallel downloads, S3 Select for server-side filtering, and Presigned URLs for secure temporary access.

Key Principle

Combine Transfer Acceleration with Multipart Upload for maximum performance on large file uploads over long distances. Tests show up to 61% faster uploads when using both features together compared to standard single-part uploads.

Exam Tip

Know when to use each feature: Transfer Acceleration for distant users, Multipart Upload for large files (>100 MB), Byte-Range Fetches for parallel downloads, S3 Select for filtering CSV/JSON/Parquet data, and Presigned URLs for temporary access without AWS credentials.


Architecture Diagram

The following diagram illustrates how S3 transfer optimization features work together:

S3 Transfer Optimization Architecture
Figure 1: S3 transfer optimization features including Transfer Acceleration via CloudFront edge locations and Multipart Upload for parallel transfers

Key Concepts

S3 Transfer Acceleration

S3 Transfer Acceleration

S3 Transfer Acceleration (S3TA) speeds up long-distance transfers by routing data through Amazon CloudFront's globally distributed edge locations.

How It Works:

  1. Client uploads data to the nearest CloudFront edge location
  2. Data travels over AWS's optimized backbone network to S3
  3. Reduces the impact of internet routing, congestion, and distance

Performance Benefits:

  • 50-500% faster transfers over long distances
  • Minimizes latency caused by geographic distance
  • Fully utilizes available bandwidth
  • Consistent performance regardless of client location

Pricing:

  • US/Europe/Japan edge: $0.04/GB transferred
  • Other edge locations: $0.08/GB transferred
  • Only charged when acceleration actually improves performance
SHEnable Transfer Acceleration
# Enable Transfer Acceleration on a bucket
aws s3api put-bucket-accelerate-configuration \
    --bucket my-bucket \
    --accelerate-configuration Status=Enabled

# Upload using accelerate endpoint
aws s3 cp large-file.zip s3://my-bucket/ \
    --endpoint-url https://s3-accelerate.amazonaws.com

When to Use Transfer Acceleration

ScenarioUse Transfer Acceleration?Why
Users uploading from same region as bucketNoMinimal benefit, adds cost
Users uploading from different continentYesSignificant latency reduction
Small files (<1 MB)NoOverhead outweighs benefit
Large files (>100 MB) over long distanceYesMaximum benefit
Consistent uploads from global locationsYesPredictable performance

Multipart Upload

Multipart Upload

Multipart Upload allows you to upload large objects as a set of parts that are uploaded in parallel, then assembled by S3.

Key Limits: | Parameter | Value | |-----------|-------| | Minimum part size | 5 MB (except last part) | | Maximum part size | 5 GB | | Maximum parts | 10,000 | | Maximum object size | 5 TB | | Recommended threshold | 100 MB |

Benefits:

  • Parallel uploads improve throughput (~40% faster)
  • Resume interrupted uploads without starting over
  • Quick recovery from network issues
  • Begin upload before knowing final file size
SHMultipart Upload with AWS CLI
# Configure AWS CLI for optimal multipart uploads
aws configure set default.s3.max_concurrent_requests 20
aws configure set default.s3.multipart_threshold 100MB
aws configure set default.s3.multipart_chunksize 16MB

# Upload automatically uses multipart for large files
aws s3 cp large-file.zip s3://my-bucket/

# Low-level multipart upload API
aws s3api create-multipart-upload --bucket my-bucket --key large-file.zip
aws s3api upload-part --bucket my-bucket --key large-file.zip \
    --part-number 1 --upload-id <upload-id> --body part1.zip
aws s3api complete-multipart-upload --bucket my-bucket --key large-file.zip \
    --upload-id <upload-id> --multipart-upload file://parts.json
Best Practice: Abort Incomplete Uploads

Incomplete multipart uploads continue to incur storage charges. Always configure a lifecycle rule to automatically abort incomplete uploads after a specified number of days.

JSONLifecycle Rule for Incomplete Uploads
{
  "Rules": [
    {
      "ID": "AbortIncompleteMultipartUploads",
      "Status": "Enabled",
      "Filter": {},
      "AbortIncompleteMultipartUpload": {
        "DaysAfterInitiation": 7
      }
    }
  ]
}

Byte-Range Fetches

Byte-Range Fetches

Byte-Range Fetches allow you to download specific portions of an object using the HTTP Range header, enabling parallel downloads and partial file retrieval.

Use Cases:

  • Parallel downloads: Fetch different ranges concurrently
  • Resume interrupted downloads: Continue from where you left off
  • Partial file access: Read only the data you need
  • Video streaming: Seek to specific positions

How It Works:

GET /object HTTP/1.1
Range: bytes=0-999999

Performance Tip: When downloading objects uploaded via multipart, use the same part boundaries for byte-range fetches to optimize performance.

SHParallel Download with Byte-Range Fetches
# Download first 50MB
curl -H "Range: bytes=0-52428799" \
    https://my-bucket.s3.amazonaws.com/large-file.zip -o part1

# Download next 50MB (in parallel)
curl -H "Range: bytes=52428800-104857599" \
    https://my-bucket.s3.amazonaws.com/large-file.zip -o part2

# Combine parts
cat part1 part2 > large-file.zip

S3 Select

S3 Select

S3 Select allows you to retrieve a subset of data from an object using SQL expressions, filtering data server-side before transfer.

Supported Formats:

  • CSV (with or without compression)
  • JSON (with or without compression)
  • Apache Parquet (columnar format)

Compression Support:

  • GZIP and BZIP2 (CSV and JSON only)
  • Server-side encrypted objects supported

Performance Benefits:

  • Up to 400% performance improvement
  • Reduced data transfer costs
  • Lower latency by filtering at source
PYS3 Select Query Example
import boto3

s3 = boto3.client('s3')

response = s3.select_object_content(
    Bucket='my-bucket',
    Key='sales-data.csv',
    ExpressionType='SQL',
    Expression="SELECT * FROM s3object s WHERE s.region = 'us-east-1' AND s.amount > 1000",
    InputSerialization={
        'CSV': {
            'FileHeaderInfo': 'USE',
            'RecordDelimiter': '\n',
            'FieldDelimiter': ','
        }
    },
    OutputSerialization={
        'CSV': {}
    }
)

# Process results
for event in response['Payload']:
    if 'Records' in event:
        print(event['Records']['Payload'].decode('utf-8'))

S3 Select vs Athena vs Client-Side Filtering

FeatureS3 SelectAthenaClient-Side
Query scopeSingle objectMultiple objectsDownloaded data
InfrastructureNoneServerlessClient resources
SQL supportSubsetFull ANSI SQLApplication code
Output formatsCSV, JSONMultipleAny
Best forSimple filters on single filesComplex analytics across filesSmall files or full downloads

Presigned URLs

Presigned URLs

Presigned URLs provide time-limited access to S3 objects without requiring AWS credentials or changing bucket policies.

Key Characteristics:

  • Grant temporary upload or download access
  • Expire after specified duration
  • No AWS credentials needed by recipient
  • Works with any HTTP client (browser, curl, etc.)

Expiration Limits: | Method | Maximum Expiration | |--------|-------------------| | Console | 12 hours | | CLI/SDK | 7 days | | IAM User credentials | 7 days | | IAM Role/STS | Token lifetime (up to 36 hours) |

PYGenerate Presigned URLs
import boto3
from datetime import datetime, timedelta

s3 = boto3.client('s3')

# Presigned URL for download (GET)
download_url = s3.generate_presigned_url(
    'get_object',
    Params={'Bucket': 'my-bucket', 'Key': 'report.pdf'},
    ExpiresIn=3600  # 1 hour
)

# Presigned URL for upload (PUT)
upload_url = s3.generate_presigned_url(
    'put_object',
    Params={'Bucket': 'my-bucket', 'Key': 'uploads/user-file.zip'},
    ExpiresIn=3600
)

# Presigned POST for browser uploads with conditions
presigned_post = s3.generate_presigned_post(
    'my-bucket',
    'uploads/${filename}',
    Fields={'acl': 'private'},
    Conditions=[
        {'acl': 'private'},
        ['content-length-range', 1, 10485760]  # 1 byte to 10 MB
    ],
    ExpiresIn=3600
)

How It Works

Combined Transfer Optimization Flow

S3 Transfer Optimization Flow
Figure 2: How Transfer Acceleration and Multipart Upload work together for optimal large file uploads

Performance Comparison

Transfer Performance Test Results

MethodTimeImprovement
Single upload (baseline)72 seconds-
Transfer Acceleration only43 seconds40% faster
Multipart Upload only (5MB parts, 6 parallel)45 seconds38% faster
Multipart + Transfer Acceleration28 seconds61% faster

Optimal Part Size Selection

Part Size Trade-offs

Part SizeProsConsBest For
5 MB (minimum)Maximum parallelization, fine-grained retryMore API calls, higher overheadUnreliable networks
16-64 MB (recommended)Balanced performance and overheadModerate parallelizationMost use cases
100+ MBFewer API calls, less overheadLess parallelization, larger retry unitsStable, high-bandwidth connections

Use Cases

Use Case 1: Global Media Upload Platform

Scenario: Video streaming service where creators worldwide upload large video files (1-50 GB) to a centralized S3 bucket in us-east-1.

Solution:

  1. Enable Transfer Acceleration on the bucket
  2. Use Multipart Upload with 64 MB parts
  3. Configure 10 parallel upload threads
  4. Implement retry logic for failed parts
PYOptimized Upload Configuration
import boto3
from boto3.s3.transfer import TransferConfig

# Configure for large file uploads with acceleration
config = TransferConfig(
    multipart_threshold=100 * 1024 * 1024,  # 100 MB
    max_concurrency=10,
    multipart_chunksize=64 * 1024 * 1024,   # 64 MB
    use_threads=True
)

s3 = boto3.client('s3',
    endpoint_url='https://s3-accelerate.amazonaws.com'
)

s3.upload_file(
    'large-video.mp4',
    'media-bucket',
    'videos/large-video.mp4',
    Config=config
)

Use Case 2: Log Analysis with S3 Select

Scenario: Application logs stored as gzipped JSON files in S3. Need to find specific error messages without downloading entire files.

Solution:

  • Use S3 Select to query compressed JSON logs
  • Filter for specific error codes and time ranges
  • Reduce data transfer by 95%+

Use Case 3: Secure File Sharing Portal

Scenario: Enterprise needs to share large reports with external partners who don't have AWS credentials.

Solution:

  1. Generate Presigned URLs for download
  2. Set appropriate expiration (e.g., 24 hours)
  3. Use Byte-Range Fetches for large files
  4. Enable resume capability for interrupted downloads

Best Practices

S3 Transfer Best Practices
  1. Use Transfer Acceleration for uploads from distant locations (>1000 km from bucket region)
  2. Enable Multipart Upload for all files > 100 MB
  3. Configure lifecycle rules to abort incomplete multipart uploads
  4. Use byte-range fetches for parallel downloads of large files
  5. Leverage S3 Select to filter data server-side when querying CSV/JSON/Parquet
  6. Use Presigned URLs instead of making buckets public for temporary access
  7. Test with Speed Comparison Tool before enabling Transfer Acceleration
  8. Match part boundaries when using byte-range fetches on multipart-uploaded objects

Common Exam Scenarios

Exam Scenarios and Solutions

ScenarioSolutionWhy
Mobile app users worldwide upload photos to S3Enable Transfer AccelerationReduces latency for globally distributed uploads
Upload 10 GB database backup filesUse Multipart Upload with 100 MB partsEnables parallel uploads, resume on failure
Share private S3 objects with external users temporarilyGenerate Presigned URLsTime-limited access without changing bucket policy
Query specific columns from large Parquet filesUse S3 SelectServer-side filtering reduces data transfer
Download large file with unstable connectionUse Byte-Range FetchesResume interrupted downloads from last position
Maximize upload speed for large files from Australia to us-east-1Transfer Acceleration + Multipart UploadCombined approach provides best performance

Common Pitfalls

Pitfall 1: Not Aborting Incomplete Multipart Uploads

Mistake: Starting multipart uploads without cleanup mechanisms.

Why it's costly:

  • Incomplete parts continue to incur storage charges
  • Parts are not visible in normal S3 listings
  • Can accumulate significant hidden costs

Correct Approach:

  • Configure lifecycle rule to abort incomplete uploads after 7 days
  • Implement application-level cleanup for failed uploads
  • Monitor with S3 Storage Lens for incomplete multipart uploads
Pitfall 2: Using Transfer Acceleration for Same-Region Transfers

Mistake: Enabling Transfer Acceleration for clients in the same region as the bucket.

Why it's wasteful:

  • Adds latency instead of reducing it
  • Incurs additional transfer costs
  • No performance benefit for local transfers

Correct Approach:

  • Use the AWS Speed Comparison Tool to test
  • Only enable for geographically distant clients
  • Consider using S3 endpoints for same-region transfers
Pitfall 3: Presigned URL Security Issues

Mistake: Creating presigned URLs with very long expiration times or not validating upload content.

Why it's risky:

  • URLs can be shared or leaked
  • No control once URL is generated
  • Potential for unauthorized access or malicious uploads

Correct Approach:

  • Use shortest practical expiration time
  • Add conditions to presigned POSTs (content-length, content-type)
  • Log and monitor presigned URL usage
  • Use separate bucket/prefix for untrusted uploads

Test Your Knowledge

Q

A company needs to upload 5 GB video files from users in Asia to an S3 bucket in us-west-2. What combination provides the BEST upload performance?

AS3 Standard storage class with versioning enabled
BTransfer Acceleration with Multipart Upload
CS3 Intelligent-Tiering with Cross-Region Replication
DServer-Side Encryption with KMS
Q

What is the MINIMUM part size for S3 Multipart Upload?

A1 MB
B5 MB
C10 MB
D100 MB
Q

A data analyst needs to find specific records from a 10 GB CSV file stored in S3 without downloading the entire file. Which feature should they use?

AS3 Transfer Acceleration
BS3 Byte-Range Fetches
CS3 Select
DS3 Inventory
Q

What is the maximum expiration time for a presigned URL generated using the AWS CLI?

A1 hour
B12 hours
C24 hours
D7 days


Quick Reference

Transfer Acceleration Endpoint Format

TEXTS3 Accelerate Endpoints
# Standard endpoint
https://bucket-name.s3.region.amazonaws.com

# Accelerate endpoint
https://bucket-name.s3-accelerate.amazonaws.com

# Dual-stack accelerate endpoint (IPv4 + IPv6)
https://bucket-name.s3-accelerate.dualstack.amazonaws.com

Multipart Upload Limits

Multipart Upload Quick Reference

ParameterValue
Minimum part size5 MB
Maximum part size5 GB
Maximum number of parts10,000
Maximum object size5 TB
Recommended upload threshold100 MB
Recommended part size16-64 MB

S3 Select SQL Support

S3 Select SQL Operations

SupportedNot Supported
SELECT, FROM, WHEREJOIN, UNION, subqueries
AND, OR, NOTGROUP BY, HAVING
LIKE, BETWEEN, INORDER BY (Parquet only)
Aggregate functions (SUM, AVG, COUNT)Window functions
CAST, COALESCE, NULLIFUser-defined functions

Further Reading

Related services

S3CloudFront