> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/action-center/aws/remove-tags-from-s3-bucket.md).

# Remove Tags from S3 Bucket

Removes the tag keys you list from every S3 bucket that the workflow passes to it. Other tags on the bucket are kept.

### Before you begin

* AWS credentials (access key ID and secret access key) that are allowed to call the AWS API actions listed below. Enter them in the node or save them once in [Action Center Settings](broken://pages/ea41765c908dc2733f18c3a1329cd7501b60f6da) (the **AWS** group has one tab per job, so each job needs its own defaults).
* Asset type: `service` only. Only service assets whose `ServiceType` is `object_storage` are used.
* Required columns: `Name` and `ServiceType`. `Name` is used as the S3 bucket name.
* AWS API actions the job calls: `GetBucketTagging`, `PutBucketTagging`, `DeleteBucketTagging` (S3).

### Settings

The node form shows these fields. Field labels are generated from the field names, so they appear as listed here. The AWS access key ID and secret access key are plain text fields, not masked fields.

| Setting               | Type             | Required | Default | Description                                                                                                                                                                                      |
| --------------------- | ---------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Aws access key id     | Text             | Yes      | None    | AWS access key ID the job signs its requests with. Not masked in the form or in Settings.                                                                                                        |
| Aws secret access key | Text             | Yes      | None    | Secret access key for the key ID above. Not masked in the form or in Settings.                                                                                                                   |
| Aws region            | Text             | Yes      | None    | AWS region the client connects to, for example `eu-west-1`. The value may be empty.                                                                                                              |
| Tag Keys              | Long text (JSON) | No       | `[]`    | JSON array of tag keys to remove, for example `["TestTag", "Environment"]`. Anything that is not an array of strings is rejected. An empty array makes the job fail with `No tag keys provided`. |

### How it works

The job takes the `Name` of every incoming service asset whose `ServiceType` is `object_storage` and treats each as a bucket. If there are none, the job fails with `No S3 buckets found in selected assets`.

For each bucket the job reads the current tags (`GetBucketTagging`; a bucket without tags counts as empty) and then:

* If the bucket has no tags, or none of your keys, it is skipped.
* If other tags remain, it writes them back with `PutBucketTagging`.
* If no tag would remain, it calls `DeleteBucketTagging`.

If **Tag Keys** is an empty array the job fails with `No tag keys provided`. If an AWS call fails for a bucket, the job fails with `AWS S3 delete bucket tagging failed for bucket <name>`. Buckets handled before it keep their change and later buckets are not processed.

The job does not change the asset data. It passes the incoming assets unchanged to the next node.

### Example

Put the job after a condition node (Service inventory) whose saved query returns the buckets to clean up.

| Setting               | Value                        |
| --------------------- | ---------------------------- |
| Aws access key id     | `YOUR_AWS_ACCESS_KEY_ID`     |
| Aws secret access key | `YOUR_AWS_SECRET_ACCESS_KEY` |
| Aws region            | `eu-west-1`                  |
| Tag Keys              | `["TestTag", "Environment"]` |

### Related jobs

To add tags, use [Add Tags to S3 Bucket](broken://pages/652755eb6447754c9d289a442962c627a9266592). For EC2 instances use [Remove Tags from EC2 Instance](broken://pages/3c27931f66eb91c5baeb42c0c63653b4542c43f1).

### What's next?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>About Action Center</strong></td><td>Workflows, triggers, conditions and job nodes.</td><td><a href="broken://pages/94a9962c87c4d45ae1ec3bb263b516656f67490d">Broken link</a></td></tr><tr><td><strong>Action Center Settings</strong></td><td>Save the AWS connection values as job defaults.</td><td><a href="broken://pages/ea41765c908dc2733f18c3a1329cd7501b60f6da">Broken link</a></td></tr><tr><td><strong>Add Tags to S3 Bucket</strong></td><td>A related AWS job.</td><td><a href="broken://pages/652755eb6447754c9d289a442962c627a9266592">Broken link</a></td></tr></tbody></table>
