S3 Batch Operations Operator
What this skill does
Executes S3 Batch Operations jobs correctly and safely at any scale. Runs
deterministic pre-checks before any state-changing CLI (manifest format
and readability, report bucket writability, IAM role permission chain
including operation-specific grants, KMS decrypt/encrypt path for
SSE-KMS objects, Lambda invoke permission for Lambda operations,
rate-control validity, manifest object-count estimate), executes the
create-job behind a CONFIRM gate, and verifies the result by polling
describe-job until Status: Complete, reading the completion report,
and reconciling Failed count against an acceptable threshold. Every
job plan names the operation-specific IAM grants; every diagnose-job
surfaces the failure-mode table so the operator knows whether the root
cause is permissions, manifest format, throttling, or a per-object error.
Quick navigation
| Section |
What it covers |
When to read it |
| § Quick reference |
Verdict thresholds (BLOCKED/READY/COMPLETED) + pre-check priority |
Before any operation |
| § Mindset |
Why a batch job is a manifest + role + report + rate-control quad, the false-green trap |
Understanding the safety model |
| § Pre-flight |
Job spec gate — manifest versioning, report bucket region, role ARN |
Before executing any CLI |
| § Process |
Per-operation planning: create-job, diagnose-job, cancel-job, update-priority |
When choosing which operation to run |
| § Output format |
STRICT output contract — OPERATION/VERDICT/PRE_CHECKS/STEPS/POST_VERIFY/NOTES template |
Formatting the response |
| § Anti-Patterns |
NEVER list — common mistakes that silently fail jobs or skip objects |
Review before risky operations |
| § Pre-flight safety |
Capture pre-state, IAM role policy, KMS key policy, manifest validation |
Defense-in-depth |
| § Expert heuristic |
Batch Operations is async and per-object failures are silent — never trust Active alone |
Avoiding the false-green trap |
STRICT output contract
EVERY response MUST end with a single fenced text block in this exact
shape (the operator's downstream tooling greps for it). No deviations:
OPERATION: <create-job | diagnose-job | cancel-job | update-priority>
VERDICT: READY | BLOCKED | COMPLETED
TARGET: <manifest-bucket/path> (operation: <type>, role: <arn-or-"none">)
PRE_CHECKS:
- [PASS] <check description>
- [FAIL] <check description> — <reason>
STEPS:
1. <CLI command with flags populated, or "(none — pre-checks failed)">
2. <wait / monitoring command>
POST_VERIFY:
- [PASS] <verification description> | (pending execution)
- [FAIL] <verification description> — <reason>
NOTES: <rate-control, monitoring, caveats>
Rules of the contract:
- VERDICT is exactly one of
READY, BLOCKED, COMPLETED. No other
values. READY means pre-checks passed and a CONFIRM gate is
pending; BLOCKED means at least one pre-check failed — do NOT emit
STEPS that mutate state; COMPLETED means post-verification passed
after the job finished.
- If PRE_CHECKS has any
[FAIL], VERDICT MUST be BLOCKED and STEPS
MUST be (none — pre-checks failed).
- If VERDICT is
READY, STEPS[1] MUST be the CONFIRM prompt and
STEPS[2] MUST be the actual create-job CLI.
- If VERDICT is
COMPLETED, POST_VERIFY MUST contain at least one
[PASS] and no [FAIL].
- Never wrap the block in JSON, never abbreviate the field names,
never omit a section. If a section is empty, write
(none).
Quick reference — verdict thresholds
| Verdict |
Trigger condition |
Action |
BLOCKED |
One or more pre-checks failed (manifest unreadable, report bucket not writable, role missing batchoperations:* or operation-specific grants, KMS decrypt denied for SSE-KMS source, Lambda resource policy missing batchoperations.amazonaws.com principal, rate-control invalid, manifest contains zero objects, destination bucket missing for copy) |
List failures, do NOT execute |
READY |
All pre-checks passed; awaiting CONFIRM gate |
Emit exact create-job CLI with all flags populated, wait for operator yes |
COMPLETED |
Job reached Status: Complete AND post-verification passed (Failed count within threshold, completion report readable, sample objects verified) |
Emit verification results, monitoring plan |
Priority order for pre-checks (apply in this sequence, all must pass
for READY):
- Manifest format and readability. Manifest is a versioned S3
inventory report (with
manifest.json + manifest.checksum) OR a
CSV file (bucket,key per line, versioned CSV requires a third
column). The role can read the manifest object(s).
- Report bucket configured and writable.
ReportBucket is in the
same Region as the Batch Operations job. Role has s3:PutObject on
the report prefix.
- IAM role permission chain. Role has
batchoperations:* on the
job ARN (or *), plus read on the manifest bucket and write on the
target bucket(s). Operation-specific grants (see table below).
- KMS decrypt path on source. For SSE-KMS objects, the role has
kms:Decrypt on the source key ARN AND the source key policy
grants the role.
- KMS encrypt path on destination. For copy or re-encrypt
operations, the role has
kms:Encrypt on the destination key ARN
AND the destination key policy grants the role.
- Lambda invoke permission. For invoke operations, the Lambda's
resource-based policy allows
batchoperations.amazonaws.com to
lambda:InvokeFunction, scoped to the job role ARN.
- Rate-control validity.
RequestsPerSecond (if set) is in
[1, 2500]. CompletionWindow (if set) is between 1 hour and 1 year.
- Object-count estimate. Manifest object count produces an ETA
within the configured
CompletionWindow. For billion+ object
manifests, verify the rate limit produces a sub-window ETA.
Cost/time baselines (2026):
- Per-object processing time: 0.5-2 seconds typical (operation-
dependent; Glacier restore and Lambda invoke are slower).
- Default rate: S3 Batch Operations auto-scales within the account's
S3 request budget; explicit
RequestsPerSecond caps it.
- Job setup latency: 1-5 minutes from
create-job to Active.
- Completion report: written within minutes of job
Complete.
- Cost: per-request charges (PUT/GET/restore) plus a Batch Operations
per-object processing fee (see S3 pricing).
Mindset
One-line takeaway: Status: Active on a Batch Operations job is a
scheduling claim, not a delivery claim. A job is only "done" when
Status: Complete, the completion report shows the expected success
count, and a sample of objects verifies the operation actually applied.
Driven by three S3 Batch Operations realities:
- A batch job is a manifest + role + report + rate-control quad.
The manifest enumerates objects; the role grants the operation;
the report records results; the rate-control prevents runaway costs.
A single broken link makes the entire job fail or silently skip —
the job shows
Active on dashboards while objects are untouched.
- Per-object failures are silent. A job can complete with tens of
thousands of
Failed entries while Status: Complete looks green.
Operators who do not read the completion report discover the failure
weeks later when downstream effects surface.
- Large jobs (billion+ objects) need explicit rate-control. Without
RequestsPerSecond, the job can saturate the source or destination
bucket's request budget, crowd out application traffic, and exhaust
KMS request quotas (especially for decrypt+re-encrypt). Always set a
rate limit for jobs over 100 million objects.
Pre-flight: job spec gate
Run before classification. Misclassifying these produces wrong plans.
Pagination: list-bucket-inventory-configurations paginates at
100. describe-job returns the full job descriptor in one call. CSV
manifests have no native pagination — estimate the object count from
the file size (each line averages 80-120 bytes for bucket,key).
Live-account pre-flight (skip if offline plan audit):
The eight live-account pre-flight probes (manifest head-object, report-bucket region, versioning capture, role policy chain, KMS key state, destination KMS, Lambda policy, describe-job): references/diagnostic-commands.md.
Malformed input: if the input JSON is invalid or missing required
fields, emit VERDICT: ERROR with REASON: Job spec is not valid JSON or is missing required fields — cannot plan. and REMEDIATION: Re-validate the spec against the operation schema in references/ operation-iam-matrix.md and re-plan.
| Job spec attribute |
Effect on operation |
Manifest.Spec.Format: S3InventoryReport |
Requires manifest.json + manifest.checksum. Versioned inventory required for version-aware operations. |
Manifest.Spec.Format: CSV |
Each line is bucket,key (unversioned) or bucket,key,versionId (versioned). No header row. |
Operation mismatch with manifest versioning |
A versioned operation (e.g., object lock retention) on an unversioned manifest BLOCKS. |
Report.Bucket not in job Region |
BLOCKED. Batch Operations requires the report bucket in the same Region as the job. |
Role missing iam:PassRole on the caller side |
create-job itself fails with AccessDenied. Caller needs iam:PassRole on the role ARN. |
RequestsPerSecond outside [1, 2500] |
BLOCKED. |
Priority outside [-2147483648, 2147483647] |
BLOCKED. Higher value = higher priority. |
| Manifest containing zero objects |
BLOCKED. |
ToggleEnabled: false |
Job created in Suspended state; will not run until update-job-status sets Ready. |
Process — operation planning (apply in order)
Step 0: Expert knowledge — non-obvious Batch Operations behaviors
These behaviors are easy to misjudge without operational experience.
Each changes a plan if ignored:
The 12 non-obvious behaviors (two-sided role, versioned-inventory requirement, no CSV header row, fixed Lambda payload, two-stage Glacier restore, ServerSideCopy re-encrypt, full-tagset replace, global priority, CompletionWindow hint, report scope, S3 Tables operations, transient throttling): references/advanced-patterns.md.
Step 1: Pre-check gate — BLOCKED if any check fails
Run ALL pre-checks for the chosen operation. If ANY fails, the verdict
is BLOCKED with the failed checks in PRE_CHECKS. Do NOT execute.
For ALL operations:
- Manifest exists and is readable by the role.
- Manifest format matches the operation's versioning requirement.
- Report bucket exists in the same Region as the planned job.
- Caller has
s3control:CreateJob AND iam:PassRole on the role.
- Role has
batchoperations:* (or scoped equivalent).
- Role has read on the manifest bucket (
s3:GetObject on the
manifest prefix).
- Role has
s3:PutObject on the report bucket prefix.
RequestsPerSecond (if set) is in [1, 2500].
Priority is within the int32 range.
- Manifest object count is non-zero.
Operation-specific pre-checks:
| Operation |
Additional checks |
| Copy |
Destination bucket exists; role has s3:PutObject on destination; for SSE-KMS source, role has kms:Decrypt; for SSE-KMS destination, role has kms:Encrypt + destination key policy grants role. |
| ReplaceTag |
Role has s3:PutObjectTagging and s3:DeleteObjectTagging on the target. New tagset does not exceed 10 keys / 256 chars per value. |
| Restore |
Source objects are in GLACIER / GLACIER_IR / DEEP_ARCHIVE. Role has s3:RestoreObject. Days and GlacierJobTier (Standard/Bulk) are set. |
| Replicate |
Source bucket has replication configured; destination rule exists. Role has s3:ReplicateObject, s3:ReplicateDelete. |
| Invoke |
Lambda State: Active. Lambda resource-based policy allows batchoperations.amazonaws.com to lambda:InvokeFunction. Lambda reserved concurrency >= RequestsPerSecond. Lambda timeout >= 60s (Batch retries on timeout, but a 3s timeout is almost always wrong). |
| PutACL |
Role has s3:PutObjectAcl on the target. Canned ACL or access-control policy is valid. |
| PutObjectLockRetention |
Target bucket has Object Lock enabled. Role has s3:PutObjectRetention. Mode is GOVERNANCE or COMPLIANCE. RetainUntilDate is in the future. |
| PutObjectLockLegalHold |
Target bucket has Object Lock enabled. Role has s3:PutObjectLegalHold. Status is ON or OFF. |
Job failure-mode table (use during diagnose-job):
The nine-row failure-mode table mapping describe-job symptoms and completion-report failure codes to root causes and fixes: references/error-handling.md.
Step 2: READY — emit operation plan
If all pre-checks pass, emit VERDICT: READY with the exact CLI
sequence and the CONFIRM gate. The plan includes:
- The exact
aws s3control create-job CLI with the JSON operation
spec inline or referenced from a file.
- The expected duration (based on manifest size and rate limit).
- The expected side-effects (object count processed, KMS request
volume, Lambda invocation count).
- The CONFIRM gate prompt.
- The monitoring commands (
describe-job polling cadence, CloudWatch
metrics to watch).
Step 3: Execute behind CONFIRM gate
- MANDATORY CONFIRMATION GATE. Before
create-job,
update-job-status, update-job-priority, or any state-changing
CLI, emit: CONFIRM: About to <operation> on job <id-or-"new"> in account <account> region <region>. This will <consequence>. Proceed? (yes/no). Do NOT execute until the operator confirms.
- Capture pre-state: if modifying an existing job,
aws s3control describe-job --account-id <account> --job-id <id> --output json > /tmp/<id>-pre-$(date +%s).json.
- For new jobs: write the operation spec to a local JSON file and
pass via
--operation. Capture the returned JobId.
- Poll
describe-job every 60 seconds (or longer for billion-object
jobs) until Status transitions away from Active.
Step 4: Post-verification — COMPLETED
After the job finishes, run post-verification. ALL checks must pass
for COMPLETED.
describe-job --job-id <id> — confirm Status: Complete.
- Read
ProgressSummary — NumberOfTasksSucceeded matches the
expected count; NumberOfTasksFailed is within the acceptable
threshold (typically 0; for billion-object jobs, < 0.01%).
- Read the completion report (
Report.Bucket). For FailedTasksOnly
scope, confirm the report is non-empty only if there were failures.
- Sample 5 objects from the manifest — verify the operation applied
(e.g., for copy,
head-object on destination; for KMS re-encrypt,
verify SSEKMSKeyId matches the new key; for tag replace, verify
get-object-tagging matches the new tagset).
- For Glacier restore: sample 5 objects — verify
Restore header
shows ongoing-request="false" (or, for bulk tier, that the
request is queued).
- For Lambda invoke: check CloudWatch Logs for the Lambda — no
errors above the expected threshold.
If ANY verification fails, emit VERDICT: ERROR with the failure
details — do not claim COMPLETED. A failed verification typically means
the job completed with unexpected failures; route to diagnose-job.
Output format (per operation)
See § STRICT output contract above. The block MUST appear exactly in
that shape at the end of the response.
Worked example — create-job (bulk KMS re-encrypt)
OPERATION: create-job
VERDICT: READY
TARGET: s3://prod-inventory/2026-08-01/manifest.json
(operation: copy with new SSE-KMS key, role:
arn:aws:iam::111111111111:role/S3BatchOpsRole)
PRE_CHECKS:
- [PASS] Manifest readable, format S3InventoryReport V2 (versioned)
- [PASS] Report bucket prod-batch-reports in us-east-1 (matches job)
- [PASS] Caller has s3control:CreateJob + iam:PassRole on
arn:aws:iam::111111111111:role/S3BatchOpsRole
- [PASS] Role has batchoperations:*, s3:GetObject on prod-inventory,
s3:PutObject on prod-batch-reports
- [PASS] Role has s3:GetObject + s3:PutObject on prod-data
- [PASS] Role has kms:Decrypt on arn:aws:kms:us-east-1:111111111111:key/old-key
- [PASS] Role has kms:Encrypt on arn:aws:kms:us-east-1:111111111111:key/new-key
- [PASS] New KMS key policy grants role Encrypt
- [PASS] RequestsPerSecond: 500 (in [1, 2500])
- [PASS] Manifest object count: 12,400,000 — ETA ~6.9h at 500 RPS
(within CompletionWindow: 24h)
STEPS:
1. CONFIRM: About to create a Batch Operations copy+re-encrypt job
on 12,400,000 objects in bucket prod-data (account
111111111111, region us-east-1), overwriting in place with new
SSE-KMS key arn:aws:kms:us-east-1:111111111111:key/new-key, at
500 RPS. Estimated cost: ~$248 (PUT+GET+SSE-KMS). Proceed?
(yes/no)
2. aws s3control create-job \
--account-id 111111111111 \
--region us-east-1 \
--priority 50 \
--role-arn arn:aws:iam::111111111111:role/S3BatchOpsRole \
--operation '{"S3InitiateRestoreObject": null}' \
--manifest '{"Spec":{"Format":"S3InventoryReport","Fields":["Bucket","Key","VersionId"]},"Location":{"ObjectArn":"arn:aws:s3:::prod-inventory/2026-08-01/manifest.json","ETag":"<etag>"}}' \
--report '{"Bucket":"arn:aws:s3:::prod-batch-reports","Prefix":"kms-reencrypt-2026-08/","Format":"Report_CSV_20180820","ReportScope":"FailedTasksOnly"}' \
--client-request-token "$(uuidgen)"
(replace --operation with the actual copy-with-new-encryption JSON)
3. Poll: aws s3control describe-job --account-id 111111111111
--job-id <returned-id> --query 'Status'
(every 5 minutes for a 7-hour job)
POST_VERIFY:
- (pending execution)
NOTES:
- Bulk KMS re-encrypt is a server-side copy with new SSE-KMS
metadata, overwriting in place. Set NewObjectMetadata.SSEKMSKeyId
to the new key in the operation JSON. Source ~12.4M Decrypt +
destination ~12.4M Encrypt requests. Verify KMS quota first.
- Use FailedTasksOnly report scope to avoid a multi-GB report.
- CloudWatch alarm on KMS Throttles during the job window.
Worked example — diagnose-job (BLOCKED with remediation)
Full diagnose-job BLOCKED example (Lambda reserved-concurrency root cause, remediation options, re-run of failed objects): references/worked-examples.md.
Worked example — create-job (Glacier bulk restore, COMPLETED)
Full Glacier bulk-restore COMPLETED example (two-stage restore verification): references/worked-examples.md.
Anti-Patterns — NEVER
NEVER create a Batch Operations job without verifying the IAM role
has the operation-specific grants. batchoperations:* is the job-
control plane permission; the actual object operations need
s3:GetObject, s3:PutObject, s3:RestoreObject,
s3:PutObjectTagging, s3:PutObjectRetention, or
s3:PutObjectAcl depending on the operation type. Missing grants
produce a job that completes with 100% failure.
NEVER include a header row in a CSV manifest. The first line is
parsed as an object. A header bucket,key produces a NoSuchKey
failure for object key in bucket bucket. Use S3 inventory
format if you want structured metadata.
NEVER assume Status: Complete means all objects were successfully
processed. Read the completion report and reconcile
NumberOfTasksFailed against an acceptable threshold. For large
jobs, use FailedTasksOnly report scope and treat any non-empty
report as a follow-up item.
NEVER run a billion-object job without an explicit
RequestsPerSecond. Default auto-scaling can saturate the source
bucket, KMS quota, or Lambda concurrency, producing throttling
cascades that exhaust the retry budget.
NEVER assume Glacier restore is finished when the Batch Operations
job is Complete. The job submits restore requests; the actual
restore is asynchronous on the Glacier side. Poll head-object --restore for ongoing-request="false" before downstream use.
NEVER pass a role ARN at create-job without verifying the caller
has iam:PassRole on that ARN. The create-job API itself fails
with AccessDenied before any object processing.
NEVER set all jobs to Priority: 2147483647. Priority is a relative
scheduling signal within the account + Region. Inflating every job
to max nullifies the priority system and produces contention.
NEVER use the Task report scope for billion-object jobs. The
completion report will be a multi-GB CSV. Use FailedTasksOnly and
read the ProgressSummary for the success count.
NEVER attempt a PutObjectLockRetention operation on a bucket
without Object Lock enabled. The operation fails per-object with
InvalidRequest. Verify get-object-lock-configuration before
creating the job.
NEVER assume Lambda invocations are idempotent. Batch Operations
retries with the same taskId. If the Lambda has side effects
(writes to a database, sends a notification), it MUST deduplicate
on taskId.
NEVER trust describe-job.ProgressSummary alone for cost
verification. Cross-check S3 and KMS CloudWatch request metrics
during the job window — throttles and retries inflate actual
request count above the object count.
NEVER forget the manifest's ETag field. For S3 inventory
manifests, the manifest.json object has an ETag that must be
passed in the Manifest.Location.ETag field. Omitting it produces
a 400 MalformedXML error from create-job.
NEVER auto-execute a state-changing Batch Operations CLI without
the CONFIRM gate. Job creation and priority changes can run up
significant costs and modify objects at scale.
Pre-flight safety checks (run before any remediation CLI)
All eight pre-flight safety checks (confirmation gate, cost estimation, manifest validation, role trust policy, KMS key state, Lambda state, report bucket region, rate-control sanity): references/advanced-patterns.md.
Expert heuristic: the silent-completion trap
The silent-completion trap in full (the rule, why it exists, verification-technique table, three-step verification protocol, FAILURE_COUNT/SAMPLE_VERIFIED surfacing, post-deploy detection): references/advanced-patterns.md.
Recent AWS features (2024-2026)
Recent AWS features detail (S3 Tables targets, server-side copy re-encrypt, FailedTasksOnly GA, per-job rate control, Glacier IR/Deep Archive tiers, Object Lock operations, cross-region jobs, AWS/S3Operations metrics): references/advanced-patterns.md.
References (load on demand)
- Advanced patterns — Step 0 non-obvious Batch Operations behaviors, pre-flight safety checks, the silent-completion trap, recent AWS features
- Worked examples — diagnose-job BLOCKED and Glacier bulk-restore COMPLETED walkthroughs
- Error handling — job failure-mode table (
describe-job symptom → root cause → fix)
- Diagnostic commands — the eight live-account pre-flight probes
Domain
AWS CloudOps / S3 Batch Operations, Bulk Object Transformation, and
At-Scale Storage Management.
AWS documentation
1---2name: s3-batch-operations-operator3description: Operates S3 Batch Operations at scale — job creation across operation types (copy, replace tag, restore from Glacier, replicate, invoke Lambda, put ACL, put object lock retention, put legal hold), manifest formats (S3 inventory report or CSV), completion reports, job priority and rate control (RequestsPerSecond), IAM permissions (batchoperations:* plus operation-specific grants), Lambda invoke for custom per-object processing, bulk storage class transition, bulk ACL fix, bulk replication backfill, bulk decrypt + re-encrypt with new KMS key, S3 Tables Batch Operations, and large-job handling for billion-object manifests. Runs deterministic pre-checks (manifest readability, report bucket writability, IAM chain, KMS decrypt/encrypt, Lambda invoke, rate-control) behind a CONFIRM gate and emits READY, BLOCKED, or COMPLETED per job. Use when running bulk object transformations, restoring Glacier archives at scale, backfilling replication, rotating KMS keys, or invoking a custom Lambda across billions of objects.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline plan classification. Live-account operations use aws s3control create-job, describe-job, update-job-priority, update-job-status, aws s3api list-bucket-inventory-configurations, get-bucket-location, get-bucket-versioning, aws lambda get-policy, aws iam list-attached-role-policies / list-role-policies, aws kms describe-key / get-key-policy, and aws logs filter-log-events (AWS CLI...6metadata:7 source: https://skillmd.com/skills/jhkchan/s3-batch-operations-operator8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '4'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Storage15 task_type: operate16 skill_class: capability17 lifecycle_status: active18 verdict_shape: READY | BLOCKED | COMPLETED19 when_to_use: Creating an S3 Batch Operations job (copy, replace tag, restore from Glacier, replicate, invoke Lambda, put ACL, put object lock retention, put object lock legal hold), diagnosing a failed or stalled job, cancelling a runaway job, adjusting job priority or rate control, backfilling replication across existing objects, bulk-transitioning storage class, bulk-rotating KMS keys via decrypt + re-encrypt, invoking a custom Lambda across a manifest of objects, or planning a billion- object batch run with safe rate limits.20 activation_triggers: S3 Batch Operations, batch copy objects, bulk restore Glacier, bulk replace tags, batch invoke Lambda, bulk replication backfill, bulk KMS re-encrypt, bulk storage class transition, put object lock retention batch, batch operations manifest, S3 inventory manifest, CSV manifest, completion report, RequestsPerSecond batch, cancel batch job, update job priority, S3 Tables batch operations, billion objects batch21 invocation_schema: 'Input: either (a) a job specification (operation type, source bucket, manifest format and location, report bucket, IAM role ARN, operation- specific parameters, priority, rate control) for plan classification, OR (b) a JobId for live-account diagnose or cancel operations. Output: deterministic OPERATION / VERDICT / PRE_CHECKS / STEPS / POST_VERIFY / NOTES block per job, where VERDICT is one of READY, BLOCKED, COMPLETED.'22 version: 0.1.023 author: Jacky Chan — AWS Community Builder24 keywords: S3 Batch Operations, create-job, manifest, S3 inventory report, CSV manifest, completion report, job priority, RequestsPerSecond, rate control, copy operation, replace tag, restore from Glacier, replicate operation, invoke Lambda, put ACL, object lock retention, object lock legal hold, bulk storage class transition, bulk ACL fix, bulk replication backfill, bulk KMS re-encrypt, S3 Tables, billion objects, batchoperations, s3:GetObject, s3:PutObject25 tags: aws, s3, s3control, storage, batch, bulk, glacier, kms, lambda, object-lock, replication, operate26---2728# S3 Batch Operations Operator2930## What this skill does3132Executes S3 Batch Operations jobs correctly and safely at any scale. Runs33deterministic pre-checks before any state-changing CLI (manifest format34and readability, report bucket writability, IAM role permission chain35including operation-specific grants, KMS decrypt/encrypt path for36SSE-KMS objects, Lambda invoke permission for Lambda operations,37rate-control validity, manifest object-count estimate), executes the38`create-job` behind a CONFIRM gate, and verifies the result by polling39`describe-job` until `Status: Complete`, reading the completion report,40and reconciling `Failed` count against an acceptable threshold. Every41job plan names the operation-specific IAM grants; every diagnose-job42surfaces the failure-mode table so the operator knows whether the root43cause is permissions, manifest format, throttling, or a per-object error.4445## Quick navigation4647| Section | What it covers | When to read it |48|---|---|---|49| **§ Quick reference** | Verdict thresholds (BLOCKED/READY/COMPLETED) + pre-check priority | Before any operation |50| **§ Mindset** | Why a batch job is a manifest + role + report + rate-control quad, the false-green trap | Understanding the safety model |51| **§ Pre-flight** | Job spec gate — manifest versioning, report bucket region, role ARN | Before executing any CLI |52| **§ Process** | Per-operation planning: create-job, diagnose-job, cancel-job, update-priority | When choosing which operation to run |53| **§ Output format** | STRICT output contract — OPERATION/VERDICT/PRE_CHECKS/STEPS/POST_VERIFY/NOTES template | Formatting the response |54| **§ Anti-Patterns** | NEVER list — common mistakes that silently fail jobs or skip objects | Review before risky operations |55| **§ Pre-flight safety** | Capture pre-state, IAM role policy, KMS key policy, manifest validation | Defense-in-depth |56| **§ Expert heuristic** | Batch Operations is async and per-object failures are silent — never trust `Active` alone | Avoiding the false-green trap |5758## STRICT output contract5960EVERY response MUST end with a single fenced text block in this exact61shape (the operator's downstream tooling greps for it). No deviations:6263```text64OPERATION: <create-job | diagnose-job | cancel-job | update-priority>65VERDICT: READY | BLOCKED | COMPLETED66TARGET: <manifest-bucket/path> (operation: <type>, role: <arn-or-"none">)67PRE_CHECKS:68 - [PASS] <check description>69 - [FAIL] <check description> — <reason>70STEPS:71 1. <CLI command with flags populated, or "(none — pre-checks failed)">72 2. <wait / monitoring command>73POST_VERIFY:74 - [PASS] <verification description> | (pending execution)75 - [FAIL] <verification description> — <reason>76NOTES: <rate-control, monitoring, caveats>77```7879Rules of the contract:8081- VERDICT is exactly one of `READY`, `BLOCKED`, `COMPLETED`. No other82 values. `READY` means pre-checks passed and a CONFIRM gate is83 pending; `BLOCKED` means at least one pre-check failed — do NOT emit84 STEPS that mutate state; `COMPLETED` means post-verification passed85 after the job finished.86- If PRE_CHECKS has any `[FAIL]`, VERDICT MUST be `BLOCKED` and STEPS87 MUST be `(none — pre-checks failed)`.88- If VERDICT is `READY`, STEPS[1] MUST be the CONFIRM prompt and89 STEPS[2] MUST be the actual `create-job` CLI.90- If VERDICT is `COMPLETED`, POST_VERIFY MUST contain at least one91 `[PASS]` and no `[FAIL]`.92- Never wrap the block in JSON, never abbreviate the field names,93 never omit a section. If a section is empty, write `(none)`.9495## Quick reference — verdict thresholds9697| Verdict | Trigger condition | Action |98|---|---|---|99| `BLOCKED` | One or more pre-checks failed (manifest unreadable, report bucket not writable, role missing `batchoperations:*` or operation-specific grants, KMS decrypt denied for SSE-KMS source, Lambda resource policy missing `batchoperations.amazonaws.com` principal, rate-control invalid, manifest contains zero objects, destination bucket missing for copy) | List failures, do NOT execute |100| `READY` | All pre-checks passed; awaiting CONFIRM gate | Emit exact `create-job` CLI with all flags populated, wait for operator yes |101| `COMPLETED` | Job reached `Status: Complete` AND post-verification passed (`Failed` count within threshold, completion report readable, sample objects verified) | Emit verification results, monitoring plan |102103**Priority order for pre-checks (apply in this sequence, all must pass104for READY):**1051061. **Manifest format and readability.** Manifest is a versioned S3107 inventory report (with `manifest.json` + `manifest.checksum`) OR a108 CSV file (`bucket,key` per line, versioned CSV requires a third109 column). The role can read the manifest object(s).1102. **Report bucket configured and writable.** `ReportBucket` is in the111 same Region as the Batch Operations job. Role has `s3:PutObject` on112 the report prefix.1133. **IAM role permission chain.** Role has `batchoperations:*` on the114 job ARN (or `*`), plus read on the manifest bucket and write on the115 target bucket(s). Operation-specific grants (see table below).1164. **KMS decrypt path on source.** For SSE-KMS objects, the role has117 `kms:Decrypt` on the source key ARN AND the source key policy118 grants the role.1195. **KMS encrypt path on destination.** For copy or re-encrypt120 operations, the role has `kms:Encrypt` on the destination key ARN121 AND the destination key policy grants the role.1226. **Lambda invoke permission.** For invoke operations, the Lambda's123 resource-based policy allows `batchoperations.amazonaws.com` to124 `lambda:InvokeFunction`, scoped to the job role ARN.1257. **Rate-control validity.** `RequestsPerSecond` (if set) is in126 [1, 2500]. `CompletionWindow` (if set) is between 1 hour and 1 year.1278. **Object-count estimate.** Manifest object count produces an ETA128 within the configured `CompletionWindow`. For billion+ object129 manifests, verify the rate limit produces a sub-window ETA.130131**Cost/time baselines (2026):**132133- Per-object processing time: 0.5-2 seconds typical (operation-134 dependent; Glacier restore and Lambda invoke are slower).135- Default rate: S3 Batch Operations auto-scales within the account's136 S3 request budget; explicit `RequestsPerSecond` caps it.137- Job setup latency: 1-5 minutes from `create-job` to `Active`.138- Completion report: written within minutes of job `Complete`.139- Cost: per-request charges (PUT/GET/restore) plus a Batch Operations140 per-object processing fee (see S3 pricing).141142## Mindset143144**One-line takeaway:** `Status: Active` on a Batch Operations job is a145scheduling claim, not a delivery claim. A job is only "done" when146`Status: Complete`, the completion report shows the expected success147count, and a sample of objects verifies the operation actually applied.148Driven by three S3 Batch Operations realities:149150- **A batch job is a manifest + role + report + rate-control quad.**151 The manifest enumerates objects; the role grants the operation;152 the report records results; the rate-control prevents runaway costs.153 A single broken link makes the entire job fail or silently skip —154 the job shows `Active` on dashboards while objects are untouched.155- **Per-object failures are silent.** A job can complete with tens of156 thousands of `Failed` entries while `Status: Complete` looks green.157 Operators who do not read the completion report discover the failure158 weeks later when downstream effects surface.159- **Large jobs (billion+ objects) need explicit rate-control.** Without160 `RequestsPerSecond`, the job can saturate the source or destination161 bucket's request budget, crowd out application traffic, and exhaust162 KMS request quotas (especially for decrypt+re-encrypt). Always set a163 rate limit for jobs over 100 million objects.164165## Pre-flight: job spec gate166167Run before classification. Misclassifying these produces wrong plans.168169**Pagination:** `list-bucket-inventory-configurations` paginates at170100. `describe-job` returns the full job descriptor in one call. CSV171manifests have no native pagination — estimate the object count from172the file size (each line averages 80-120 bytes for `bucket,key`).173174**Live-account pre-flight (skip if offline plan audit):**175The eight live-account pre-flight probes (manifest head-object, report-bucket region, versioning capture, role policy chain, KMS key state, destination KMS, Lambda policy, describe-job): [references/diagnostic-commands.md](references/diagnostic-commands.md).176177**Malformed input:** if the input JSON is invalid or missing required178fields, emit `VERDICT: ERROR` with `REASON: Job spec is not valid JSON179or is missing required fields — cannot plan.` and `REMEDIATION:180Re-validate the spec against the operation schema in references/181operation-iam-matrix.md and re-plan.`182183| Job spec attribute | Effect on operation |184|---|---|185| `Manifest.Spec.Format: S3InventoryReport` | Requires `manifest.json` + `manifest.checksum`. Versioned inventory required for version-aware operations. |186| `Manifest.Spec.Format: CSV` | Each line is `bucket,key` (unversioned) or `bucket,key,versionId` (versioned). No header row. |187| `Operation` mismatch with manifest versioning | A versioned operation (e.g., object lock retention) on an unversioned manifest BLOCKS. |188| `Report.Bucket` not in job Region | BLOCKED. Batch Operations requires the report bucket in the same Region as the job. |189| `Role` missing `iam:PassRole` on the caller side | `create-job` itself fails with `AccessDenied`. Caller needs `iam:PassRole` on the role ARN. |190| `RequestsPerSecond` outside [1, 2500] | BLOCKED. |191| `Priority` outside [-2147483648, 2147483647] | BLOCKED. Higher value = higher priority. |192| Manifest containing zero objects | BLOCKED. |193| `ToggleEnabled: false` | Job created in `Suspended` state; will not run until `update-job-status` sets `Ready`. |194195## Process — operation planning (apply in order)196197### Step 0: Expert knowledge — non-obvious Batch Operations behaviors198199These behaviors are easy to misjudge without operational experience.200Each changes a plan if ignored:201The 12 non-obvious behaviors (two-sided role, versioned-inventory requirement, no CSV header row, fixed Lambda payload, two-stage Glacier restore, ServerSideCopy re-encrypt, full-tagset replace, global priority, CompletionWindow hint, report scope, S3 Tables operations, transient throttling): [references/advanced-patterns.md](references/advanced-patterns.md).202203204### Step 1: Pre-check gate — BLOCKED if any check fails205206Run ALL pre-checks for the chosen operation. If ANY fails, the verdict207is BLOCKED with the failed checks in PRE_CHECKS. Do NOT execute.208209**For ALL operations:**2101. Manifest exists and is readable by the role.2112. Manifest format matches the operation's versioning requirement.2123. Report bucket exists in the same Region as the planned job.2134. Caller has `s3control:CreateJob` AND `iam:PassRole` on the role.2145. Role has `batchoperations:*` (or scoped equivalent).2156. Role has read on the manifest bucket (`s3:GetObject` on the216 manifest prefix).2177. Role has `s3:PutObject` on the report bucket prefix.2188. `RequestsPerSecond` (if set) is in [1, 2500].2199. `Priority` is within the int32 range.22010. Manifest object count is non-zero.221222**Operation-specific pre-checks:**223224| Operation | Additional checks |225|---|---|226| **Copy** | Destination bucket exists; role has `s3:PutObject` on destination; for SSE-KMS source, role has `kms:Decrypt`; for SSE-KMS destination, role has `kms:Encrypt` + destination key policy grants role. |227| **ReplaceTag** | Role has `s3:PutObjectTagging` and `s3:DeleteObjectTagging` on the target. New tagset does not exceed 10 keys / 256 chars per value. |228| **Restore** | Source objects are in GLACIER / GLACIER_IR / DEEP_ARCHIVE. Role has `s3:RestoreObject`. `Days` and `GlacierJobTier` (Standard/Bulk) are set. |229| **Replicate** | Source bucket has replication configured; destination rule exists. Role has `s3:ReplicateObject`, `s3:ReplicateDelete`. |230| **Invoke** | Lambda `State: Active`. Lambda resource-based policy allows `batchoperations.amazonaws.com` to `lambda:InvokeFunction`. Lambda reserved concurrency >= `RequestsPerSecond`. Lambda timeout >= 60s (Batch retries on timeout, but a 3s timeout is almost always wrong). |231| **PutACL** | Role has `s3:PutObjectAcl` on the target. Canned ACL or access-control policy is valid. |232| **PutObjectLockRetention** | Target bucket has Object Lock enabled. Role has `s3:PutObjectRetention`. `Mode` is `GOVERNANCE` or `COMPLIANCE`. `RetainUntilDate` is in the future. |233| **PutObjectLockLegalHold** | Target bucket has Object Lock enabled. Role has `s3:PutObjectLegalHold`. `Status` is `ON` or `OFF`. |234235**Job failure-mode table (use during diagnose-job):**236The nine-row failure-mode table mapping `describe-job` symptoms and completion-report failure codes to root causes and fixes: [references/error-handling.md](references/error-handling.md).237238### Step 2: READY — emit operation plan239240If all pre-checks pass, emit `VERDICT: READY` with the exact CLI241sequence and the CONFIRM gate. The plan includes:242243- The exact `aws s3control create-job` CLI with the JSON operation244 spec inline or referenced from a file.245- The expected duration (based on manifest size and rate limit).246- The expected side-effects (object count processed, KMS request247 volume, Lambda invocation count).248- The CONFIRM gate prompt.249- The monitoring commands (`describe-job` polling cadence, CloudWatch250 metrics to watch).251252### Step 3: Execute behind CONFIRM gate253254- **MANDATORY CONFIRMATION GATE.** Before `create-job`,255 `update-job-status`, `update-job-priority`, or any state-changing256 CLI, emit: `CONFIRM: About to <operation> on job <id-or-"new"> in257 account <account> region <region>. This will <consequence>.258 Proceed? (yes/no)`. Do NOT execute until the operator confirms.259- Capture pre-state: if modifying an existing job,260 `aws s3control describe-job --account-id <account> --job-id <id>261 --output json > /tmp/<id>-pre-$(date +%s).json`.262- For new jobs: write the operation spec to a local JSON file and263 pass via `--operation`. Capture the returned `JobId`.264- Poll `describe-job` every 60 seconds (or longer for billion-object265 jobs) until `Status` transitions away from `Active`.266267### Step 4: Post-verification — COMPLETED268269After the job finishes, run post-verification. ALL checks must pass270for `COMPLETED`.2712721. `describe-job --job-id <id>` — confirm `Status: Complete`.2732. Read `ProgressSummary` — `NumberOfTasksSucceeded` matches the274 expected count; `NumberOfTasksFailed` is within the acceptable275 threshold (typically 0; for billion-object jobs, < 0.01%).2763. Read the completion report (`Report.Bucket`). For `FailedTasksOnly`277 scope, confirm the report is non-empty only if there were failures.2784. Sample 5 objects from the manifest — verify the operation applied279 (e.g., for copy, `head-object` on destination; for KMS re-encrypt,280 verify `SSEKMSKeyId` matches the new key; for tag replace, verify281 `get-object-tagging` matches the new tagset).2825. For Glacier restore: sample 5 objects — verify `Restore` header283 shows `ongoing-request="false"` (or, for bulk tier, that the284 request is queued).2856. For Lambda invoke: check CloudWatch Logs for the Lambda — no286 errors above the expected threshold.287288If ANY verification fails, emit `VERDICT: ERROR` with the failure289details — do not claim COMPLETED. A failed verification typically means290the job completed with unexpected failures; route to diagnose-job.291292## Output format (per operation)293294See § STRICT output contract above. The block MUST appear exactly in295that shape at the end of the response.296297### Worked example — create-job (bulk KMS re-encrypt)298299```text300OPERATION: create-job301VERDICT: READY302TARGET: s3://prod-inventory/2026-08-01/manifest.json303 (operation: copy with new SSE-KMS key, role:304 arn:aws:iam::111111111111:role/S3BatchOpsRole)305PRE_CHECKS:306 - [PASS] Manifest readable, format S3InventoryReport V2 (versioned)307 - [PASS] Report bucket prod-batch-reports in us-east-1 (matches job)308 - [PASS] Caller has s3control:CreateJob + iam:PassRole on309 arn:aws:iam::111111111111:role/S3BatchOpsRole310 - [PASS] Role has batchoperations:*, s3:GetObject on prod-inventory,311 s3:PutObject on prod-batch-reports312 - [PASS] Role has s3:GetObject + s3:PutObject on prod-data313 - [PASS] Role has kms:Decrypt on arn:aws:kms:us-east-1:111111111111:key/old-key314 - [PASS] Role has kms:Encrypt on arn:aws:kms:us-east-1:111111111111:key/new-key315 - [PASS] New KMS key policy grants role Encrypt316 - [PASS] RequestsPerSecond: 500 (in [1, 2500])317 - [PASS] Manifest object count: 12,400,000 — ETA ~6.9h at 500 RPS318 (within CompletionWindow: 24h)319STEPS:320 1. CONFIRM: About to create a Batch Operations copy+re-encrypt job321 on 12,400,000 objects in bucket prod-data (account322 111111111111, region us-east-1), overwriting in place with new323 SSE-KMS key arn:aws:kms:us-east-1:111111111111:key/new-key, at324 500 RPS. Estimated cost: ~$248 (PUT+GET+SSE-KMS). Proceed?325 (yes/no)326 2. aws s3control create-job \327 --account-id 111111111111 \328 --region us-east-1 \329 --priority 50 \330 --role-arn arn:aws:iam::111111111111:role/S3BatchOpsRole \331 --operation '{"S3InitiateRestoreObject": null}' \332 --manifest '{"Spec":{"Format":"S3InventoryReport","Fields":["Bucket","Key","VersionId"]},"Location":{"ObjectArn":"arn:aws:s3:::prod-inventory/2026-08-01/manifest.json","ETag":"<etag>"}}' \333 --report '{"Bucket":"arn:aws:s3:::prod-batch-reports","Prefix":"kms-reencrypt-2026-08/","Format":"Report_CSV_20180820","ReportScope":"FailedTasksOnly"}' \334 --client-request-token "$(uuidgen)"335 (replace --operation with the actual copy-with-new-encryption JSON)336 3. Poll: aws s3control describe-job --account-id 111111111111337 --job-id <returned-id> --query 'Status'338 (every 5 minutes for a 7-hour job)339POST_VERIFY:340 - (pending execution)341NOTES:342 - Bulk KMS re-encrypt is a server-side copy with new SSE-KMS343 metadata, overwriting in place. Set NewObjectMetadata.SSEKMSKeyId344 to the new key in the operation JSON. Source ~12.4M Decrypt +345 destination ~12.4M Encrypt requests. Verify KMS quota first.346 - Use FailedTasksOnly report scope to avoid a multi-GB report.347 - CloudWatch alarm on KMS Throttles during the job window.348```349350### Worked example — diagnose-job (BLOCKED with remediation)351352Full diagnose-job BLOCKED example (Lambda reserved-concurrency root cause, remediation options, re-run of failed objects): [references/worked-examples.md](references/worked-examples.md).353354### Worked example — create-job (Glacier bulk restore, COMPLETED)355356Full Glacier bulk-restore COMPLETED example (two-stage restore verification): [references/worked-examples.md](references/worked-examples.md).357358## Anti-Patterns — NEVER359360- NEVER create a Batch Operations job without verifying the IAM role361 has the operation-specific grants. `batchoperations:*` is the job-362 control plane permission; the actual object operations need363 `s3:GetObject`, `s3:PutObject`, `s3:RestoreObject`,364 `s3:PutObjectTagging`, `s3:PutObjectRetention`, or365 `s3:PutObjectAcl` depending on the operation type. Missing grants366 produce a job that completes with 100% failure.367368- NEVER include a header row in a CSV manifest. The first line is369 parsed as an object. A header `bucket,key` produces a `NoSuchKey`370 failure for object `key` in bucket `bucket`. Use S3 inventory371 format if you want structured metadata.372373- NEVER assume `Status: Complete` means all objects were successfully374 processed. Read the completion report and reconcile375 `NumberOfTasksFailed` against an acceptable threshold. For large376 jobs, use `FailedTasksOnly` report scope and treat any non-empty377 report as a follow-up item.378379- NEVER run a billion-object job without an explicit380 `RequestsPerSecond`. Default auto-scaling can saturate the source381 bucket, KMS quota, or Lambda concurrency, producing throttling382 cascades that exhaust the retry budget.383384- NEVER assume Glacier restore is finished when the Batch Operations385 job is `Complete`. The job submits restore requests; the actual386 restore is asynchronous on the Glacier side. Poll `head-object387 --restore` for `ongoing-request="false"` before downstream use.388389- NEVER pass a role ARN at `create-job` without verifying the caller390 has `iam:PassRole` on that ARN. The `create-job` API itself fails391 with `AccessDenied` before any object processing.392393- NEVER set all jobs to `Priority: 2147483647`. Priority is a relative394 scheduling signal within the account + Region. Inflating every job395 to max nullifies the priority system and produces contention.396397- NEVER use the `Task` report scope for billion-object jobs. The398 completion report will be a multi-GB CSV. Use `FailedTasksOnly` and399 read the `ProgressSummary` for the success count.400401- NEVER attempt a `PutObjectLockRetention` operation on a bucket402 without Object Lock enabled. The operation fails per-object with403 `InvalidRequest`. Verify `get-object-lock-configuration` before404 creating the job.405406- NEVER assume Lambda invocations are idempotent. Batch Operations407 retries with the same `taskId`. If the Lambda has side effects408 (writes to a database, sends a notification), it MUST deduplicate409 on `taskId`.410411- NEVER trust `describe-job.ProgressSummary` alone for cost412 verification. Cross-check S3 and KMS CloudWatch request metrics413 during the job window — throttles and retries inflate actual414 request count above the object count.415416- NEVER forget the manifest's `ETag` field. For S3 inventory417 manifests, the `manifest.json` object has an ETag that must be418 passed in the `Manifest.Location.ETag` field. Omitting it produces419 a `400 MalformedXML` error from `create-job`.420421- NEVER auto-execute a state-changing Batch Operations CLI without422 the CONFIRM gate. Job creation and priority changes can run up423 significant costs and modify objects at scale.424425## Pre-flight safety checks (run before any remediation CLI)426427All eight pre-flight safety checks (confirmation gate, cost estimation, manifest validation, role trust policy, KMS key state, Lambda state, report bucket region, rate-control sanity): [references/advanced-patterns.md](references/advanced-patterns.md).428429## Expert heuristic: the silent-completion trap430431The silent-completion trap in full (the rule, why it exists, verification-technique table, three-step verification protocol, FAILURE_COUNT/SAMPLE_VERIFIED surfacing, post-deploy detection): [references/advanced-patterns.md](references/advanced-patterns.md).432433## Recent AWS features (2024-2026)434435Recent AWS features detail (S3 Tables targets, server-side copy re-encrypt, FailedTasksOnly GA, per-job rate control, Glacier IR/Deep Archive tiers, Object Lock operations, cross-region jobs, AWS/S3Operations metrics): [references/advanced-patterns.md](references/advanced-patterns.md).436437## References (load on demand)438439- [Advanced patterns](references/advanced-patterns.md) — Step 0 non-obvious Batch Operations behaviors, pre-flight safety checks, the silent-completion trap, recent AWS features440- [Worked examples](references/worked-examples.md) — diagnose-job BLOCKED and Glacier bulk-restore COMPLETED walkthroughs441- [Error handling](references/error-handling.md) — job failure-mode table (`describe-job` symptom → root cause → fix)442- [Diagnostic commands](references/diagnostic-commands.md) — the eight live-account pre-flight probes443444## Domain445446AWS CloudOps / S3 Batch Operations, Bulk Object Transformation, and447At-Scale Storage Management.448449## AWS documentation450451- **S3 Batch Operations User Guide** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html452- **Batch Operations operations** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops-operations.html453- **Creating a Batch Operations job** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops-create-job.html454- **Batch Operations IAM role** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops-iam-role.html455- **S3 inventory configuration** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-inventory.html456- **S3 Tables (Apache Iceberg)** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables.html457- **S3 Control API Reference** — https://docs.aws.amazon.com/AmazonS3/latest/APIReference/control.html458- **S3 Batch Operations pricing** — https://aws.amazon.com/s3/pricing/