Terraform Series - AWS DynamoDB
Amazon DynamoDB is a fully managed proprietary NoSQL database service that supports key–value and document data structures and is offered by Amazon.com as part of the Amazon Web Services portfolio.
A table is a collection of items, and each item is a collection of attributes.
DynamoDB uses primary keys to uniquely identify each item in a table and secondary indexes to provide more querying flexibility.
The following are the basic DynamoDB components:
Tables – Similar to other database systems, DynamoDB stores data in tables. A table is a collection of data.
Items – Each table contains zero or more items. An item is a group of attributes that is uniquely identifiable among all of the other items.
Attributes – Each item is composed of one or more attributes. An attribute is a fundamental data element, something that does not need to be broken down any furthe
People table contains attributes called PersonID, LastName, FirstName.
resource "aws_dynamodb_table" "cars"{
name = "cars"
hash_key = "VIN"
billing_mode = "PAY_PER_REQUEST"
attribute {
name = "VIN"
type = "S"
}
}
resource "aws_dynamodb_table_item" "car-items"{
table_name = aws_dynamodb_table.cars.name
hash_key = aws_dynamodb_table.cars.hash_key
item = <<ITEM
{
"Manufacturer": {"S":"Ford"},
"Model": {"S": "Focus"},
"Year": {"N": "2013"},
"VIN": {"S": "aded12344"}
}
ITEM
}
Comments
Post a Comment