Score:0

How to get items DynamoDB table using CDK

br flag

I am creating a Stack using CDK, and I store my user Data in DynamoDB.

What I want to do is to create some resources for each user using CDK. After a quick search I found out about AwsCustomResource.

Here is what I tried:

const customResource = new cdk.custom_resources.AwsCustomResource(this, 'aws-custom', {
      onCreate: {
        service: 'DynamoDB',
        action: 'scan',
        parameters: {
          TableName: 'Users'
        },
        physicalResourceId: cdk.custom_resources.PhysicalResourceId.of('Users' + '_scan'),
      },
      policy: cdk.custom_resources.AwsCustomResourcePolicy.fromSdkCalls({
        resources: cdk.custom_resources.AwsCustomResourcePolicy.ANY_RESOURCE,
      })
    });

const data = customResource.getResponseField("Items");
console.log(data)

I also tried to Token.asList and Token.asString but nothing worked.

Any ideas on the best way to get data from Dynamo DB using CDK ?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.