Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamoDB deletion protection on production environment #13551

Closed
ggorge-etiqa opened this issue Jan 24, 2024 · 7 comments
Closed

DynamoDB deletion protection on production environment #13551

ggorge-etiqa opened this issue Jan 24, 2024 · 7 comments
Labels
override Issues related to resource override CDK functionality pending-response Issue is pending response from the issue author pending-triage Issue is pending triage question General question

Comments

@ggorge-etiqa
Copy link

Amplify CLI Version

12.6.0

Question

As deletion protection feature is available for DynamoDB.
announcement: https://aws.amazon.com/jp/about-aws/whats-new/2023/03/amazon-dynamodb-table-deletion-protection/
I'm wondering if it's possible to set this flag only to tables in the production environment.
Is it something we can do with override.ts ?

@ggorge-etiqa ggorge-etiqa added pending-triage Issue is pending triage question General question labels Jan 24, 2024
@ykethan
Copy link
Member

ykethan commented Jan 24, 2024

Hey @ggorge-etiqa, thank you for reaching out. Could you clarify if the DynamoDB table was created on the storage category or the API category?

for example on a DynamoDB table created on storage category, we should be able to use overrides to enable deletion protection.

example:

import {
  AmplifyDDBResourceTemplate,
  AmplifyProjectInfo,
} from "@aws-amplify/cli-extensibility-helper";

export function override(
  resources: AmplifyDDBResourceTemplate,
  amplifyProjectInfo: AmplifyProjectInfo
) {
    if(amplifyProjectInfo.envName === "dev") {
  resources.dynamoDBTable.deletionProtectionEnabled = true;
    }
}

@ykethan ykethan added pending-response Issue is pending response from the issue author override Issues related to resource override CDK functionality labels Jan 24, 2024
@ggorge-etiqa
Copy link
Author

Hi @ykethan I think it's in the API category. The DynamoDB tables I want to protect from deletion are created by AppSync.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Jan 24, 2024
@ykethan
Copy link
Member

ykethan commented Jan 24, 2024

@ggorge-etiqa thank you for the clarification. Please refer to this override example : #13465 (comment)

resources.models[<model>].modelDDBTable.deletionProtectionEnabled = true;

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Jan 24, 2024
@ggorge-etiqa
Copy link
Author

thanks @ykethan

    if (amplifyProjectInfo.envName === "prod") {

        for (const model in resources.models) {      
            resources.models[model].modelDDBTable.deletionProtectionEnabled = true;
            console.log(resources.models[model].modelDDBTable); //ensure property is set
        }

    }

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Jan 24, 2024
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@ggorge-etiqa ggorge-etiqa reopened this Jan 24, 2024
@ykethan
Copy link
Member

ykethan commented Jan 25, 2024

@ggorge-etiqa noticed the issue was re-opened. Is there anything else i can assist on this?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Jan 25, 2024
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
override Issues related to resource override CDK functionality pending-response Issue is pending response from the issue author pending-triage Issue is pending triage question General question
Projects
None yet
Development

No branches or pull requests

2 participants