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

[aws-dynamodb] Fail to create a global table due to replication time-out #10249

Assignees
Labels
@aws-cdk/aws-dynamodb Related to Amazon DynamoDB effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1

Comments

@sungbokang
Copy link

sungbokang commented Sep 8, 2020

Hi,

I'm trying to add one more DynamoDB global table(replica) in us-west-2 region.

But it never succeeded in creating the replica. replica-provider currently uses a default totalTimeout(30 minutes) value of CustomResourceProvider so that it always fails if expected replication time is more than 30 minutes: https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/aws-dynamodb/lib/replica-provider.ts#L74-L77

Reproduction Steps

First, my DynamoDB constructor is like this, which tells that it already had us-east-1 and eu-west-1 regions.

import { Construct } from '@aws-cdk/core';
import {
    AttributeType,
    BillingMode,
    Table,
    StreamViewType
} from '@aws-cdk/aws-dynamodb';

export class TestTable extends Table {

    static readonly TABLE_NAME = 'test'

    constructor(parent: Construct, currentRegion: string) {
        super(parent, 'test', {
            tableName: test.TABLE_NAME,
            partitionKey: {
                name: 'key',
                type: AttributeType.STRING
            },
            sortKey: {
                name: 'rank',
                type: AttributeType.NUMBER
            },
            timeToLiveAttribute: 'ttl',
            billingMode: BillingMode.PAY_PER_REQUEST,
            stream: StreamViewType.NEW_AND_OLD_IMAGES,
            replicationRegions: ['us-east-1', 'eu-west-1']
                .filter(region => region.toLowerCase() !== currentRegion.toLowerCase())
        });
    }
}

And then create a bunch of data enough to make a replication process takes more than 30 minutes. (For our case, we have 20Gb data in our table approximately)

After that, append us-west-2 region in order to add the global table dynamically.

replicationRegions: ['us-east-1', 'eu-west-1', `us-west-2`]

What did you expect to happen?

The global table in us-west-2 region should have been created well.

What actually happened?

While creating a global table, CloudFormation threw CREATE_FAILED with a Failed to create resource. Operation timed out message. As trying to create the global table several times, this happens in 33 minutes exactly after the time when Custom::DynamoDBReplica becomes ``CREATE_IN_PROGRESS` status.

Environment

  • CLI Version : 1.32
  • Framework Version:
  • Node.js Version: NodeJS12.x
  • OS : Amazon Linux 2012.03
  • Language (Version): Typescript 3.9.2

Other

  • Suggestion on how to fix : I'd suggest to fix this by allowing clients to inject customised totalTimeout value into replica-provider instead of sticking to the default 30 minutes value.
  • Related issues : After the replica failure happens, Rollback procedure happens but it also fails. Because a IAM role of OnEventHandler reverts before deleting the global table. So deleting the global table fails with a DELETE_FAILED - Failed to delete resource because of lack of permission. Regarding this, I created one another issue: [aws-dynamodb] Fail to rollback if global table creation is failed #10256

This is 🐛 Bug Report

@sungbokang sungbokang added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 8, 2020
@github-actions github-actions bot added the @aws-cdk/aws-dynamodb Related to Amazon DynamoDB label Sep 8, 2020
@skinny85
Copy link
Contributor

Hey @sungbokang ,

thanks for opening the issue.

Do I understand correctly that your ask is basically to surface the totalTimeout property of the custom resource provider when creating the replication tables in DynamoDB?

Thanks,
Adam

@skinny85 skinny85 added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 16, 2020
jogold added a commit to jogold/aws-cdk that referenced this issue Mar 2, 2021
@mergify mergify bot closed this as completed in #13354 Mar 8, 2021
mergify bot pushed a commit that referenced this issue Mar 8, 2021
Closes #10249


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Mar 8, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or 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.

This was referenced Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment