Security

S3 Security Best Practices: Protect Your Data

· AWS Cloud Consulting

S3 is one of the most commonly exploited AWS services in data breaches. Not because S3 is insecure — it is because S3 is everywhere and misconfiguration is easy. Publicly exposed buckets, overly permissive policies, missing encryption, and absent logging have led to some of the largest cloud data breaches in history. Securing S3 properly requires understanding the multiple layers of access control, encryption, monitoring, and data protection that AWS provides.

Why S3 Is a Top Breach Target

S3 stores everything — customer data, application logs, database backups, credentials, intellectual property, and compliance-sensitive documents. It is the default storage layer for virtually every AWS architecture. This ubiquity makes it a high-value target for attackers.

The most common breach vector is unintentional public access. A single misconfigured bucket policy or ACL can expose millions of records to the internet. AWS has introduced multiple safeguards against this, but they must be explicitly enabled and enforced across your entire organization.

Beyond public access, S3 breaches occur through overly permissive IAM policies, compromised credentials with broad S3 access, and misconfigured cross-account sharing. A defense-in-depth approach addresses all of these vectors simultaneously.

Block Public Access at the Account Level

S3 Block Public Access is your first and most important control. It overrides any bucket policy or ACL that would grant public access. Enable it at the account level to protect all current and future buckets.

Account-level settings: In the S3 console, navigate to Block Public Access settings for this account and enable all four options. This prevents any bucket in the account from being made public, regardless of individual bucket policies or ACLs.

Organization-level enforcement: Use a Service Control Policy (SCP) in AWS Organizations to prevent anyone from disabling Block Public Access. This ensures that even administrators cannot accidentally or intentionally expose buckets in member accounts.

Exception handling: If you have a legitimate need for public buckets (static website hosting, public datasets), create those buckets in a dedicated account with appropriate controls and monitoring. Never mix public and private data in the same account.

Bucket Policies vs ACLs: Use Policies, Disable ACLs

S3 has two access control mechanisms: bucket policies (resource-based JSON policies) and Access Control Lists (ACLs). ACLs are the legacy mechanism and are a frequent source of misconfiguration.

Disable ACLs: AWS recommends setting bucket ownership to "Bucket owner enforced" which disables ACLs entirely. All access control is then managed exclusively through bucket policies and IAM policies. This eliminates an entire class of misconfiguration.

Bucket policies: Use JSON-based bucket policies for all resource-level access control. Bucket policies support conditions (IP restrictions, VPC endpoint restrictions, MFA requirements, encryption requirements) that ACLs cannot express. They are also auditable and version-controllable.

Least privilege: Every bucket policy should grant the minimum permissions required. Avoid wildcard principals ("Principal": "*") unless combined with restrictive conditions. Use specific IAM role ARNs, account IDs, or VPC endpoint conditions to limit who can access the bucket.

Encryption: SSE-S3, SSE-KMS, and Bucket Keys

All S3 buckets should have default encryption enabled. As of January 2023, AWS automatically encrypts all new objects with SSE-S3, but you should explicitly configure your encryption strategy.

SSE-S3 (default): AWS manages the encryption keys entirely. Zero configuration required, no additional cost. Provides encryption at rest but no access control over the encryption keys themselves. Suitable for most workloads where key management is not a compliance requirement.

SSE-KMS: Encryption using AWS KMS keys that you control. Provides audit trails of key usage via CloudTrail, key rotation, and the ability to revoke access by disabling the key. Required for compliance frameworks that mandate customer-managed encryption keys (HIPAA, PCI-DSS, FedRAMP).

S3 Bucket Keys: When using SSE-KMS, enable S3 Bucket Keys to reduce KMS API calls by up to 99%. Without Bucket Keys, every object operation calls KMS separately. With Bucket Keys, S3 uses a bucket-level key that reduces both latency and KMS costs significantly.

Enforce encryption in transit: Add a bucket policy condition that denies any request where aws:SecureTransport is false. This ensures all access to the bucket uses HTTPS, preventing data interception over unencrypted connections.

Access Logging and Monitoring

Without logging, you cannot detect unauthorized access, investigate breaches, or demonstrate compliance. Enable multiple layers of monitoring for comprehensive visibility.

S3 Server Access Logging: Records every request made to your bucket — who accessed what, when, from where, and whether it succeeded. Store access logs in a separate dedicated logging bucket with its own retention policy. Essential for forensic investigation after a security incident.

CloudTrail data events: Provides API-level logging for S3 operations integrated with your existing CloudTrail infrastructure. More structured than server access logs and integrates with CloudWatch, EventBridge, and security tooling. Enable data events for all S3 buckets containing sensitive data.

Amazon Macie: Automatically discovers and classifies sensitive data (PII, credentials, financial data) stored in your S3 buckets. Macie alerts you when sensitive data is found in buckets with insufficient access controls. Run periodic discovery jobs across all buckets to identify data you did not know was sensitive.

VPC Endpoints for Private Access

By default, S3 traffic from EC2 instances routes through the internet (via NAT Gateway or Internet Gateway). VPC endpoints keep S3 traffic entirely within the AWS network, improving both security and cost.

Gateway endpoints: Free to use, gateway VPC endpoints route S3 traffic directly from your VPC to S3 without traversing the internet. This eliminates NAT Gateway data processing charges ($0.045/GB) and removes the internet as an attack surface for S3 access.

Bucket policy restrictions: Add a condition to your bucket policy that only allows access from your specific VPC endpoint (aws:sourceVpce condition). This ensures the bucket can only be accessed from within your VPC, even if credentials are compromised and used from outside your network.

Versioning and MFA Delete

Versioning: Enable versioning on all buckets containing important data. Versioning protects against accidental overwrites and deletions by preserving every version of every object. Deleted objects are not actually removed — they receive a delete marker and can be recovered.

MFA Delete: Requires multi-factor authentication to permanently delete object versions or disable versioning on a bucket. This prevents an attacker with stolen credentials from permanently destroying data unless they also have physical access to an MFA device. Enable MFA Delete on buckets containing critical or compliance-sensitive data.

Lifecycle rules for versions: Versioning without lifecycle management leads to unbounded storage growth. Configure lifecycle rules to transition non-current versions to cheaper storage classes after 30 days and permanently delete them after your retention period (90 days, 1 year, or whatever compliance requires).

Object Lock for Immutability

S3 Object Lock provides WORM (Write Once Read Many) protection at the object level. Once locked, an object cannot be deleted or overwritten for the specified retention period — not even by the root account in compliance mode.

Governance mode: Protects objects from deletion by most users but allows users with specific IAM permissions to override the lock. Useful for protecting against accidental deletion while retaining administrative override capability.

Compliance mode: Nobody can delete or overwrite the object until the retention period expires. Not even the root account. This is required for regulatory compliance (SEC Rule 17a-4, FINRA, HIPAA) where data immutability must be provably enforced. Enable Object Lock at bucket creation — it cannot be added to existing buckets.

S3 Access Points for Multi-Application Access

When multiple applications or teams access the same bucket, bucket policies become complex and error-prone. S3 Access Points simplify this by providing dedicated endpoints with their own policies for each application.

Dedicated policies: Each Access Point has its own access policy, scoped to specific prefixes or actions. Application A gets read-write access to /app-a/ through its Access Point. Application B gets read-only access to /shared/ through its Access Point. No single complex bucket policy required.

VPC-restricted Access Points: Create Access Points that are only accessible from a specific VPC. This provides network-level isolation between applications accessing the same bucket, even if they share an AWS account.

Lifecycle Policies for Cost and Security

Lifecycle policies serve both cost optimization and security purposes. Data that exists longer than necessary is data that can be breached. Automated deletion reduces your attack surface.

Data retention enforcement: Configure lifecycle rules that automatically delete objects after your retention period expires. This ensures you are not storing data longer than legally required, reducing both storage costs and breach impact.

Incomplete multipart upload cleanup: Failed multipart uploads leave fragments that accumulate invisibly. Add a lifecycle rule to abort incomplete multipart uploads after 7 days. This prevents orphaned data from persisting in your buckets indefinitely.

Monitoring with CloudTrail Data Events

CloudTrail data events provide the most comprehensive audit trail for S3 operations. Unlike management events (which track bucket-level operations), data events track object-level operations — GetObject, PutObject, DeleteObject.

Detect unauthorized access: Configure EventBridge rules to alert on unusual patterns — access from unexpected IP ranges, bulk downloads, access to sensitive prefixes outside business hours, or access by principals that have never accessed the bucket before.

Cost consideration: Data events generate charges per 100,000 events. For high-traffic buckets, this can be significant. Enable data events selectively on buckets containing sensitive or regulated data rather than blanket-enabling across all buckets. Use advanced event selectors to filter to specific prefixes or operations.

Defense in Depth Is Non-Negotiable for S3

No single control prevents all S3 breaches. Block Public Access prevents accidental exposure. Encryption protects data if storage media is compromised. VPC endpoints prevent network-level interception. Logging enables detection and investigation. Object Lock prevents data destruction. Implement all layers — the cost of a data breach far exceeds the cost of comprehensive S3 security.

Free Download

Free 2026 Small Business Cybersecurity Checklist

25 actionable security checks to reduce cyber risk, improve compliance, and strengthen your IT environment.

Download Free Checklist →

Book a Free 30 Minute Consultation

Our AWS Security Review examines your S3 configuration, identifies exposed buckets and missing controls, and provides a prioritized remediation plan to secure your data.

Book a Consultation →