The Serverless Framework uses CloudFormation to deploy our functions. Using the resources section we can deploy and configure a wide range of AWS services using raw CloudFormation definitions. In this session we demonstrate this by adding a DynamoDB table to our application.
Your table can be seen here.
Do you mind clarifying this YAML syntax?
AttributeDefinitions:
- <---- ?
AttributeName: id
AttributeType: S
@Reilly Sweetland sure, it's a list and in this case a list of objects
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
-
AttributeName: createdAt
AttributeType: N # for number
A list of strings would look like this:
- "cat"
- "dog"
Ah! Thank you. Fantastic course, btw. Really appreciate you putting it together.
Glad you like it!
Quick tip, if you deploy successfully and can't see the table in AWS make sure you're on the same location it's deploying to. I spent way too long scratching my head on that one.
Quick tip, if you deploy successfully and can't see the table in AWS make sure you're on the same location it's deploying to. I spent way too long scratching my head on that one.
Thank you!
Could you please help on this error:
validation error detected: Value 'Hash' at 'keySchema.1.member.keyType' failed to satisfy constraint: Member must satisfy enum value set: [HASH, RANGE] (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: C5PFA84D3TQ1EPFN15EAUBBH83VV4KQNSO5AEMVJF66Q9ASUAAJG)
Use HASH instead of Hash
I've followed the guide, updated the YML with the DynamoDB defintion, run the script, which succeeds, but no new DynamoDB instance exists in my AWS account.
What am I doing wrong?
I've followed the guide, updated the YML with the DynamoDB defintion, run the script, which succeeds, but no new DynamoDB instance exists in my AWS account.
What am I doing wrong?
Seems nothing - although the default region of us-east-1
doesn't seem to support DynamoDB, I changed to my AWS accounts default region, and can now see the Lambda and the DynamoDB instance
Luke, worked for me with us-east-1
(which was set up for me by default, and I'm actually in a different region).
The reason I've started reading comments is that it didn't work first. It was just a typo in my case.