Lab 17: Create DynamoDB Table Using Terraform
The Nautilus DevOps team needs to set up a DynamoDB table for storing user data. They need to create a DynamoDB table with the following specifications:
-
The table name should be
devops-users. -
The primary key should be
devops_id(String). -
The table should use
PAY_PER_REQUESTbilling mode.
Use Terraform to create this DynamoDB table. The Terraform working directory is /home/bob/terraform. Create the main.tf file (do not create a different .tf file) to create the DynamoDB table.
Note: Right-click under the EXPLORER section in VS Code and select Open in Integrated Terminal to launch the terminal.
Create main.tf
resource "aws_dynamodb_table" "devops-users" {
name = "devops-users"
hash_key = "devops_id"
billing_mode = "PAY_PER_REQUEST"
attribute {
name = "devops_id"
type = "S"
}
}
terraform init
terraform plan -out kke.plan && terraform apply kke.plan
# or apply forcefully without creating plan and applying it
terraform apply -auto-approve
aws s3 ls
aws s3api get-public-access-block --bucket devops-s3-32379