Skip to content

Delete S3 object

Deletes one exact S3-compatible object key.

@lainstack/s3/delete-object · Object storage

Delete S3 object deletes one object by its exact key. It cannot delete by prefix, pattern or list. To remove several objects, find keys with @lainstack/s3/list-objects and run this block once per key with @lainstack/flow/for-each-item.

This block changes remote data and has no undo from this block. A test run does not make it side-effect free, so confirm with the user before test-running a draft that contains it. Put an approval step before it when a person should confirm the key (use @lainstack/flow/approval).

Traps:

  • Check outcome. It is delete_accepted or outcome_unknown. With outcome_unknown the step still succeeds and the object may still exist.
  • delete_accepted means the storage service accepted the request. The block does not check that the object existed or that it is now gone.
  • The key is exact and relative to the connection’s configured prefix. It cannot start with http://, https://, s3:// or arn:.
  • bucket is optional. Set it only when the connection does not already select one.
Setting Key Type Details
S3-compatible connection (required) credentialId Connection Uses the selected S3-compatible object-storage connection. At most 255 characters.
Bucket bucket Text Optional exact bucket when the connection does not already select one. Keys are relative to the configured connection prefix.
Object key (required) key Text Exact object key, relative to the configured connection prefix.
Output Path Type
Object key key Text
Outcome outcome Text