Kanji
・Cloud engineer / freelance ・Born in 1993 ・From Ehime / Living in Shibuya, Tokyo ・5 years AWS experience Profile details
Table of Contents
[S3.5]
BucketOwnerEnforced
If-None-Match
If-Match
When introducing Amazon S3 into a corporate organization or production system, it is easy to assume that “S3 is just cheap object storage—create a bucket, turn on encryption, and we are done.” When I standardized multi-account S3 governance across an enterprise AWS Organizations environment, I ran into two painful mistakes that forced costly rework.
The first happened when we enabled AWS KMS customer managed keys (SSE-KMS) on S3 buckets receiving millions of daily batch intermediate files and application logs. The following month, while S3 storage itself cost only a few dollars, our AWS KMS API request charges ( $0.03 per 10,000 requests) jumped to several hundred dollars—and during peak batch runs, we hit regional KMS request quotas ( KMS.ThrottlingException ). The culprit was that we had not enabled S3 Bucket Keys ( BucketKeyEnabled: true ) . Once we turned S3 Bucket Keys on, S3 cached a time-limited bucket-level key internally instead of calling KMS for every single object, immediately cutting our KMS API calls and KMS bill by nearly 99%.
$0.03
KMS.ThrottlingException
BucketKeyEnabled: true
The second trap was AWS Security Hub control [S3.5] S3 general purpose buckets should require requests to use SSL . In our bucket policy denying aws:SecureTransport: "false" , we originally specified only the object ARN ( arn:aws:s3:::example-bucket/* ) in the Resource element. Security Hub continued to mark [S3.5] as FAILED because bucket-level operations such as s3:ListBucket target the bucket ARN itself ( arn:aws:s3:::example-bucket ). Both ARNs must be listed in the Resource array to pass compliance checks.
[S3.5] S3 general purpose buckets should require requests to use SSL
aws:SecureTransport: "false"
arn:aws:s3:::example-bucket/*
Resource
FAILED
s3:ListBucket
arn:aws:s3:::example-bucket
Drawing on those lessons, this guide covers the core architectural decisions required when adopting Amazon S3 in an organization: data classification, 5-layer access control and Data Perimeters, KMS encryption with S3 Bucket Keys, storage class and lifecycle optimization, ransomware resilience, and recent capabilities including Conditional Writes and S3 Metadata (S3 Tables).
▲ Enterprise Amazon S3 Architecture: Defense-in-Depth (Data Perimeter / KMS Bucket Key), Lifecycle Optimization, and Audit Integration
When designing a system on AWS, the first step is deciding whether data belongs on Amazon EBS (block storage), Amazon EFS (file storage), or Amazon S3 (object storage).
While database files requiring sub-millisecond OS-level block I/O belong on EBS, the following workloads should be consolidated on Amazon S3 to leverage its eleven nines (99.999999999%) of durability and low storage cost:
For log data in particular, the following AWS services natively support direct delivery (or delivery via Amazon Data Firehose) to S3 buckets. In a multi-account AWS Organizations environment, audit logs should be centralized into a dedicated Log Archive account bucket protected by S3 Object Lock (WORM):
Mixing confidential PII and general operational data inside a single S3 bucket makes bucket policies and KMS key boundaries overly complex, increasing the risk of accidental exposure. Start by classifying organizational data into three macro tiers (Confidential, General, Public) and isolating buckets and KMS keys accordingly.
A critical rule here is that even for “General Web Public” assets, you should never make the S3 bucket itself public . Always place Amazon CloudFront in front of the bucket and restrict S3 read access exclusively to CloudFront via Origin Access Control (OAC). This allows you to enforce S3 Block Public Access uniformly across 100% of buckets in your organization without exceptions.
Enterprise S3 access control combines source-side and destination-side guardrails (a Data Perimeter) so that even an overly permissive IAM role cannot leak data outside your organization.
Enforce two baseline settings across all accounts and IaC templates (Terraform / CloudFormation):
BlockPublicAcls
IgnorePublicAcls
BlockPublicPolicy
RestrictPublicBuckets
aws s3control put-public-access-block
Furthermore, since May 2024, AWS no longer charges S3 bucket owners for unauthorized HTTP 403 (Access Denied) requests initiated by third parties . As long as Block Public Access and Bucket Policies reject unauthorized requests with 403 , external bucket-name guessing or brute-force traffic will not inflate your AWS bill.
HTTP 403 (Access Denied)
403
We govern S3 access across five distinct layers:
RequireSSL
aws:PrincipalOrgID
kms:Decrypt
ReadOnlyAccess
Managing bucket names one by one inside a VPC Endpoint Policy does not scale. Instead, use aws:PrincipalOrgID and aws:ResourceOrgID with your AWS Organizations ID ( o-xxxxxxxxxx ) to permit S3 traffic only when both the caller and the target bucket belong to your organization.
aws:ResourceOrgID
o-xxxxxxxxxx
Be sure to explicitly allow s3:GetObject on AWS-managed buckets in your region (such as Amazon Linux 2023 dnf repositories, SSM Agent, and Patch Manager buckets); otherwise, EC2 package installations and SSM patching in private subnets will fail.
s3:GetObject
dnf
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowOnlyMyOrganizationAccess", "Effect": "Allow", "Principal": "*", "Action": "s3:*", "Resource": "*", "Condition": { "StringEquals": { "aws:PrincipalOrgID": "o-xxxxxxxxxx", "aws:ResourceOrgID": "o-xxxxxxxxxx" } } }, { "Sid": "AllowAWSManagedBucketsInTokyo", "Effect": "Allow", "Principal": "*", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::al2023-repos-ap-northeast-1-de612dc2/*", "arn:aws:s3:::aws-windows-downloads-ap-northeast-1/*", "arn:aws:s3:::amazon-ssm-ap-northeast-1/*", "arn:aws:s3:::aws-ssm-ap-northeast-1/*", "arn:aws:s3:::patch-baseline-snapshot-ap-northeast-1/*", "arn:aws:s3:::aws-patch-manager-ap-northeast-1-552881074/*", "arn:aws:s3:::aws-patchmanager-macos-ap-northeast-1-552881074/*" ] } ] }
As noted earlier, passing Security Hub [S3.5] requires specifying both the bucket ARN and the object wildcard ARN ( /* ) in the Resource array. You can also combine the s3:if-none-match condition key (GA in late 2024) to force clients writing to immutable prefixes to include the If-None-Match: "*" header, blocking accidental overwrites at the bucket policy level.
/*
s3:if-none-match
If-None-Match: "*"
{ "Version": "2012-10-17", "Statement": [ { "Sid": "RequireSSLForBucketAndObjects", "Effect": "Deny", "Principal": "*", "Action": "s3:*", "Resource": [ "arn:aws:s3:::example-confidential-bucket", "arn:aws:s3:::example-confidential-bucket/*" ], "Condition": { "Bool": { "aws:SecureTransport": "false" } } }, { "Sid": "EnforceConditionalWriteNoOverwrite", "Effect": "Deny", "Principal": "*", "Action": "s3:PutObject", "Resource": "arn:aws:s3:::example-confidential-bucket/immutable-records/*", "Condition": { "Null": { "s3:if-none-match": "true" } } } ] }
When uploading via AWS CLI or SDK with --if-none-match "*" , if an object with the same key already exists, S3 rejects the overwrite with 412 Precondition Failed —eliminating the need to maintain an external DynamoDB lock table for write-once workloads.
--if-none-match "*"
412 Precondition Failed
Amazon S3 provides SSE-S3 (AES-256 default encryption at no additional charge) and SSE-KMS (AWS Key Management Service) for server-side encryption.
The primary architectural reason to choose SSE-KMS with a Customer Managed Key (CMK) for confidential and audit buckets is Separation of Duties : even if an engineer or support role holds AWS-managed ReadOnlyAccess , they cannot read objects in a KMS-encrypted bucket unless their role is also granted kms:Decrypt on that specific CMK.
Whenever you enable SSE-KMS, always enable S3 Bucket Keys ( BucketKeyEnabled: true ) . The sequence diagram below illustrates how S3 Bucket Keys eliminate per-object KMS round-trips:
One important detail when enabling S3 Bucket Keys: if your IAM policies or KMS key policies restrict access using the kms:EncryptionContext:aws:s3:arn condition key, note that with S3 Bucket Keys enabled, the encryption context is the bucket ARN ( arn:aws:s3:::bucket-name ) rather than the object ARN ( arn:aws:s3:::bucket-name/key-name ) . Verify your EncryptionContext conditions before toggling Bucket Keys on existing workloads.
kms:EncryptionContext:aws:s3:arn
arn:aws:s3:::bucket-name
arn:aws:s3:::bucket-name/key-name
EncryptionContext
Your long-term S3 bill depends heavily on matching storage classes and lifecycle rules to object size and access patterns. Below is a comparison of major storage classes in the Tokyo region ( ap-northeast-1 ):
ap-northeast-1
$0.025
$0.11
$0.0125
$0.004
$0.0025
$0.0138
$0.01
$0.0045
$0.00099
$0.001
AbortIncompleteMultipartUpload
aws s3 ls
To protect against accidental deletion and ransomware encryption, combine three resilience controls:
NoncurrentVersionExpiration
DeleteObject
s3:BypassGovernanceRetention
ap-northeast-3
Historically, auditing metadata across hundreds of millions of S3 objects required either slow ListObjectsV2 pagination or waiting up to 24--48 hours for S3 Inventory reports.
ListObjectsV2
With Amazon S3 Metadata (introduced at re:Invent 2024 and expanded through 2025--2026), S3 automatically captures object creations, updates, and deletions in near real time (within minutes) into managed Amazon S3 Tables (Apache Iceberg format) . Without managing Glue crawlers or manual Iceberg compaction, you can run standard SQL queries in Amazon Athena to identify objects uploaded in the past hour, audit encryption status, or track storage growth across prefixes in seconds.
When standardizing Amazon S3 across an enterprise or production system, embed these four guardrails directly into your baseline IaC templates:
That said, whether to enable S3 Metadata (S3 Tables) across every bucket or reserve it for high-churn data lakes and audit buckets still depends on balancing S3 Tables maintenance costs against your team’s SQL query frequency. I am currently rolling out S3 Metadata incrementally starting with multi-million-object audit buckets to evaluate the exact cost-to-query trade-off in production. Start by locking in the four baseline guardrails above in your Terraform or CloudFormation modules.
Amazon S3 is a service that builds object storage in the AWS cloud. Save data includes static conten ... [Read more]
Production-ready CloudFormation and IaC templates for Amazon Athena WorkGroups, AWS Glue Data Catalo ... [Read more]
Amazon VPC is a service for building a virtual private cloud within the AWS cloud. By using VPC, you ... [Read more]
Master conversation skills with realistic AI phone training and 5-axis feedback. Includes 16-lesson interactive academy and studio AI portraits.
Effortlessly snap receipts for instant AI itemization. Integrated with LINE for seamless group expense tracking and pain-free settlement.
Interactive AI personas (Fortune Teller, Butler, Bartender) host real-time games, challenges, and conversation starters for unforgettable gatherings.
Real-time AI quant analysis of earnings reports, corporate filings, and momentum indicators for global equities and Japanese stocks.
Unbiased healthcare database featuring zero-additive filters and active ingredient cost performance metrics.
Get the complete configuration pack featured in this article: universal AGENTS.md, deterministic hooks.json, Git safety guardrails, and validation scripts tested across Antigravity, Kiro, Claude Code, and Codex.