Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon DynamoDB Attribute Type with CloudFormation

I'm working on a Serverless web application and I'm trying to create a CloudFormation YAML template for a DynamoDB table. The documentation says that each attribute in the table should follow the style below, where AttributeType can be either 'S', 'N' or 'B', for string, number or binary.

AttributeName: String
AttributeType: String

My table includes attributes that are maps. How do I include them in the template?

like image 462
Jay Vaidya Avatar asked Mar 01 '17 18:03

Jay Vaidya


People also ask

What is attribute type S in DynamoDB?

S - the attribute is of type String.

What are the three attributes of DynamoDB?

DynamoDB uses three basic data model units, Tables, Items, and Attributes. Tables are collections of Items, and Items are collections of Attributes.

What is attribute in AWS DynamoDB?

In Amazon DynamoDB, an item is a collection of attributes. Each attribute has a name and a value. An attribute value can be a scalar, a set, or a document type. For more information, see Amazon DynamoDB: How it works. DynamoDB provides four operations for basic create, read, update, and delete (CRUD) functionality.


1 Answers

When creating the Dynamodb table, you dont need to mention all the attributes of the table. Only two attributes are mandatory while creating the table I.e. partition key and sort key if available.

As you have mentioned that the attribute is map, definitely it can't be partition key or sort key because key attributes can only be scalar data type.

The simple answer is you dont need to define the map attribute (document data type) in CloudFormation create table script.

like image 53
notionquest Avatar answered Sep 17 '22 17:09

notionquest