CloudVectra Logo CloudVectra
CloudVectra Knowledge Hub

Amazon S3 Security: Bucket Policies, IAM, Encryption and Common Misconfigurations

Secure S3 with clear policy boundaries, encryption choices, cross-account examples, recovery controls and practical audit checks.

7 min read

An encrypted bucket can still leak data. Most S3 exposure comes from permissions, credentials, delivery paths, or forgotten copies. Effective protection combines identity controls, resource policies, network boundaries, and recoverable data.

This guide focuses on general purpose buckets. Directory, table, and vector buckets have separate policy namespaces and feature support.

1. Overview: evaluate the whole request

A request identifies a principal, action, resource, and context. AWS evaluates the applicable policies and guardrails; an explicit deny wins over an allow. Permissions boundaries, session policies, and organization policies can restrict access even when a bucket policy appears to permit it.

Separate three questions: who may read or write, who may administer the controls, and who may recover or permanently delete historical data. Giving one application all three privileges increases the impact of a compromised role.

2. Types and configurations: identity versus resource controls

ControlAttached toTypical use
IAM identity policyRole, user, or groupWhat this identity may do
Bucket policyBucketWhich principals may access it and under what conditions
Access point policyNamed access pointApplication-specific access boundary
KMS key policyEncryption keyWho can use or administer the key
Block Public AccessAccount, bucket, access pointReject or restrict public grants
Object OwnershipBucketDisable ACLs and establish ownership

Keep all four Block Public Access settings enabled unless a reviewed delivery requirement demands otherwise. Use Bucket owner enforced Object Ownership for ordinary modern workloads; ACLs are disabled in that mode. Old upload tools that send unsupported ACLs can fail.

3. Architecture: a private request path

Original pencil-style sketch showing a role passing network and policy checks before accessing an encrypted S3 object, with separate audit logs

Figure 1 — Network access, S3 authorization, and KMS authorization solve different parts of the request.

An application role can reach S3 through a gateway VPC endpoint. Its endpoint policy limits reachable resources, while bucket and IAM policies authorize operations. The endpoint grants no access by itself.

Access points give teams distinct endpoints and policies for shared datasets. They work with the underlying bucket permissions; adding an access point does not automatically disable direct bucket access. Review both paths.

Cross-account read example

Account A owns the bucket; Account B owns an analytics role. Add the following statement to Account A’s bucket policy, replacing the bucket and role ARN. It grants object reads only within one prefix.

{
  "Version": "2012-10-17",
  "Statement": [{
    "Sid": "ReadApprovedReports",
    "Effect": "Allow",
    "Principal": {"AWS": "arn:aws:iam::222222222222:role/AnalyticsReader"},
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::example-company-data/approved/*"
  }]
}

The external role also needs an identity-policy allow for the same action and resource. Add s3:ListBucket on the bucket ARN with an appropriate prefix condition only if listing is required. For SSE-KMS data, the reader also needs kms:Decrypt, permitted by the customer-managed key policy or grant. AWS-managed aws/s3 keys do not support this cross-account sharing pattern.

4. Limits and quotas: permissions have boundaries

Bucket policies have a 20-KB limit. Large per-user grants become hard to review; prefer roles, suitable conditions, and access points. KMS request quotas can also affect high-throughput object operations, so an apparent S3 performance failure may originate in encryption calls.

A blanket deny unless aws:SourceVpce matches can also block console use and service integrations. Test the exact recovery, replication, delivery, and administration paths before applying network restrictions.

5. Gotchas: the usual routes to exposure

  1. - Wildcard principals or broad cross-account grants expose more than the intended prefix.
  2. - Presigned URLs act as bearer credentials until expiry or another applicable restriction stops them.
  3. - CORS controls browser behavior; it does not authorize S3 requests.
  4. - Public delivery caches, exports, logs, and replicas can retain data after the origin policy is corrected.
  5. - A missing encryption header can mean default encryption applied; a policy that rejects it may break valid clients.

Avoid logging presigned URLs, credentials, or document contents in application traces. During an exposure incident, inspect actual object access and downstream copies as well as the policy change.

6. Security: encryption and deletion protection

EncryptionKey controlCost and operating implication
SSE-S3S3 manages keysAutomatic baseline; no separate KMS request charge
SSE-KMSAWS KMS key policies and auditKey and API charges; KMS permissions and quotas matter
DSSE-KMSTwo independent encryption layersHigher charges; use for a multilayer requirement

S3 Bucket Keys can reduce KMS request traffic for SSE-KMS; they are not supported for DSSE-KMS. Changing default encryption affects new writes, not all existing objects. Inventory older objects before claiming a completed migration.

Versioning preserves earlier object versions but does not stop a privileged caller deleting them. Object Lock requires versioning and protects individual versions. Governance retention can be bypassed with the appropriate permission and explicit bypass request; compliance retention cannot be shortened during its period, including by root. Legal holds persist until an authorized caller removes them.

Read-only audit checks

Use AWS CLI v2 with a read-only audit role and an existing bucket. These Bash-compatible commands inspect configuration; they do not harden it.

aws s3api get-public-access-block --bucket example-company-data
aws s3api get-bucket-ownership-controls --bucket example-company-data
aws s3api get-bucket-encryption --bucket example-company-data
aws s3api get-bucket-versioning --bucket example-company-data
aws s3api get-bucket-policy-status --bucket example-company-data
aws s3api get-object-lock-configuration --bucket example-company-data

A missing configuration can return an error rather than an empty record. Inspect account-level Block Public Access too. An AccessDenied response is not evidence that the control is enabled.

7. Pricing: include the controls around storage

For an illustrative symmetric customer-managed KMS key, assume $1 per key-month plus $0.03 per 10,000 billable requests. Three million billable requests add $9, or $10 with one base key. This excludes free allowances, rotation-related key-material charges, additional keys, and other services.

CloudTrail object data events, log storage, security analysis, replicas, and retained versions add separate costs. Budget these explicitly rather than disabling useful evidence after an unexpected bill.

8. Optimization: reduce privilege and operational friction

Use short-lived role credentials, prefix-scoped permissions, and dedicated roles for ingestion, retrieval, and administration. Separate critical backup ownership from the production application’s account where recovery requirements justify it.

For private asset delivery, use CloudFront Origin Access Control and restrict the bucket to the intended distribution. Require TLS with an appropriate bucket policy, taking AWS service principal behavior into account. Test allows and denies using the application’s real identity, including cross-account and recovery cases.

9. Monitoring and governance: capture evidence of access

Enable CloudTrail data events for relevant object operations; ordinary management event history does not automatically give a complete object-access audit. Keep audit logs in a separately controlled destination and set retention deliberately.

Use IAM Access Analyzer for external access findings, AWS Config for configuration drift, and GuardDuty S3 Protection for suspicious activity where enabled. Macie can help discover sensitive data. Alert on policy changes, public settings, key disablement, versioning changes, and unusual reads or deletions. Verify event selectors and detection coverage with a controlled test.

10. AWS/Azure comparison: similar goals, different authorization

Azure Blob Storage uses Microsoft Entra identities and Azure RBAC for data access, with managed identities recommended for applications. Shared Access Signatures provide delegated access and require careful scope and expiry management. Disabling anonymous blob access does not revoke an otherwise valid SAS.

Azure private endpoints, customer-managed keys, versioning, and immutable blob storage address similar needs, but scope and supported combinations differ. Translate each control objective and test it; do not mechanically copy an S3 policy into an Azure design.

Sources and further reading

Review your S3 access and recovery controls

CloudVectra Professional Services can help assess bucket permissions, cross-account access, encryption, audit coverage, and recovery controls against your security requirements.

Choose whether CloudVectra may load optional analytics. You can change this at any time.

Cookie names, providers, and retention