summaryrefslogtreecommitdiff
path: root/examples/cloudformation.yml
blob: fa830916b6650c56695fa55e2222bf578f700c0d (plain)
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
AWSTemplateFormatVersion: "2010-09-09"
Description: An example of creating a DynamoDB table to use as a requests-cache backend

Parameters:
  CacheTableName:
    Type: String
    Default: http_cache
    Description: >
      An alternate DynamoDB table name to use. If provided, this must match the
      table_name parameter for DynamoDbCache.

Resources:
  DynamoDBRequestCache:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: !Ref CacheTableName
      AttributeDefinitions:
        - AttributeName: key
          AttributeType: S
      KeySchema:
        - AttributeName: key
          KeyType: HASH
      # BillingMode: PAY_PER_REQUEST

      # Optional: Use provisioned throughput instead of on-demand
      BillingMode: PROVISIONED
      ProvisionedThroughput:
          WriteCapacityUnits: 2
          ReadCapacityUnits: 2

      # Optional: Enable DynamoDB's TTL feature
      TimeToLiveSpecification:
        AttributeName: ttl
        Enabled: true