Skip to content

feat(storage): add keepOnDelete to defineStorage()#3163

Open
adrianjoshua-strutt wants to merge 5 commits intomainfrom
fix/storage-removal-policy
Open

feat(storage): add keepOnDelete to defineStorage()#3163
adrianjoshua-strutt wants to merge 5 commits intomainfrom
fix/storage-removal-policy

Conversation

@adrianjoshua-strutt
Copy link
Copy Markdown
Member

@adrianjoshua-strutt adrianjoshua-strutt commented Apr 8, 2026

Adds an optional keepOnDelete prop to defineStorage(). When set to false, the construct sets autoDeleteObjects to false automatically. Sandbox deployments always use DESTROY.

import { defineStorage } from '@aws-amplify/backend';

export const storage = defineStorage({
  name: 'amplifyTeamDrive',
  keepOnDelete: true,
});

Issue number, if available: #3147

Corresponding docs PR, if applicable: aws-amplify/docs#8548

Checklist

  • If this PR includes a functional change to the runtime behavior of the code, I have added or updated automated test coverage for this change.
  • If this PR requires a docs update, I have linked to that docs PR above.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@adrianjoshua-strutt adrianjoshua-strutt requested a review from a team as a code owner April 8, 2026 12:49
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 8, 2026

🦋 Changeset detected

Latest commit: f7ee43c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@aws-amplify/backend-storage Minor
@aws-amplify/backend Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread packages/backend-storage/src/construct.test.ts Fixed
@adrianjoshua-strutt adrianjoshua-strutt force-pushed the fix/storage-removal-policy branch 2 times, most recently from 508a9f7 to 7051de6 Compare April 8, 2026 13:14
@adrianjoshua-strutt adrianjoshua-strutt requested a review from a team as a code owner April 8, 2026 13:14
@adrianjoshua-strutt adrianjoshua-strutt force-pushed the fix/storage-removal-policy branch 2 times, most recently from 3d051d9 to 2c796d1 Compare April 8, 2026 13:23
@adrianjoshua-strutt adrianjoshua-strutt requested a review from a team as a code owner April 8, 2026 13:23
Adds an optional removalPolicy prop to defineStorage(). When set to 'retain', the construct sets autoDeleteObjects to false automatically. Sandbox deployments always use DESTROY.
@adrianjoshua-strutt adrianjoshua-strutt force-pushed the fix/storage-removal-policy branch from 2c796d1 to f2408b6 Compare April 8, 2026 13:33
@adrianjoshua-strutt adrianjoshua-strutt changed the title feat(storage): add configurable removalPolicy to defineStorage() feat(storage): add configurable keepOnDelete to defineStorage() Apr 8, 2026
@adrianjoshua-strutt adrianjoshua-strutt changed the title feat(storage): add configurable keepOnDelete to defineStorage() feat(storage): add keepOnDelete to defineStorage() Apr 8, 2026
@adrianjoshua-strutt adrianjoshua-strutt added the run-e2e Label that will include e2e tests in PR checks workflow label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-e2e Label that will include e2e tests in PR checks workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants