-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamodb.tf
44 lines (35 loc) · 949 Bytes
/
dynamodb.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
resource "aws_dynamodb_table" "views" {
name = "views"
billing_mode = "PROVISIONED"
read_capacity = 1
write_capacity = 1
hash_key = "UserId"
attribute {
name = "UserId"
type = "S"
}
}
resource "aws_dynamodb_table_item" "views" {
table_name = aws_dynamodb_table.views.name
hash_key = aws_dynamodb_table.views.hash_key
item = <<ITEM
{
"UserId": {"S": "0"},
"views":{"N": "0"}
}
ITEM
}
resource "aws_appautoscaling_target" "dynamodb_table_read_target" {
max_capacity = 10
min_capacity = 1
resource_id = "table/views"
scalable_dimension = "dynamodb:table:ReadCapacityUnits"
service_namespace = "dynamodb"
}
resource "aws_appautoscaling_target" "dynamodb_table_write_target" {
max_capacity = 10
min_capacity = 1
resource_id = "table/views"
scalable_dimension = "dynamodb:table:WriteCapacityUnits"
service_namespace = "dynamodb"
}