Skip to content

Instantly share code, notes, and snippets.

@pedrohba1
Created March 16, 2023 15:24
Show Gist options
  • Save pedrohba1/59d75fc18156091cc085a2a6de4417fb to your computer and use it in GitHub Desktop.
Save pedrohba1/59d75fc18156091cc085a2a6de4417fb to your computer and use it in GitHub Desktop.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"Users": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"KeySchema": [
{
"AttributeName": "AppId",
"KeyType": "HASH"
},
{
"AttributeName": "ApiKey",
"KeyType": "RANGE"
}
],
"AttributeDefinitions": [
{
"AttributeName": "AppId",
"AttributeType": "N"
},
{
"AttributeName": "ApiKey",
"AttributeType": "S"
},
{
"AttributeName": "Email",
"AttributeType": "S"
},
{
"AttributeName": "Password",
"AttributeType": "S"
}
],
"GlobalSecondaryIndexes": [
{
"IndexName": "GSI-Email-1",
"KeySchema": [
{
"AttributeName": "Email",
"KeyType": "HASH"
},
{
"AttributeName": "Password",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
],
"BillingMode": "PROVISIONED",
"TableName": "Users",
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
},
"TableUsersReadCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Users",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Users",
"ScalableDimension": "dynamodb:table:ReadCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableUsersReadCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableUsersReadCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Users",
"ScalableDimension": "dynamodb:table:ReadCapacityUnits",
"PolicyName": "Users-read-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBReadCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableUsersWriteCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Users",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Users",
"ScalableDimension": "dynamodb:table:WriteCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableUsersWriteCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableUsersWriteCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Users",
"ScalableDimension": "dynamodb:table:WriteCapacityUnits",
"PolicyName": "Users-write-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBWriteCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableUsersIndexGSIEmail1ReadCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Users",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Users/index/GSI-Email-1",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableUsersIndexGSIEmail1ReadCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableUsersIndexGSI-Email-1ReadCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Users/index/GSI-Email-1",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"PolicyName": "Users-index-GSI-Email-1-read-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBReadCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableUsersIndexGSIEmail1WriteCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Users",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Users/index/GSI-Email-1",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableUsersIndexGSIEmail1WriteCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableUsersIndexGSI-Email-1WriteCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Users/index/GSI-Email-1",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"PolicyName": "Users-index-GSI-Email-1-write-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBWriteCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"Messages": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"KeySchema": [
{
"AttributeName": "MessageId",
"KeyType": "HASH"
},
{
"AttributeName": "DeviceId",
"KeyType": "RANGE"
}
],
"AttributeDefinitions": [
{
"AttributeName": "MessageId",
"AttributeType": "S"
},
{
"AttributeName": "DeviceId",
"AttributeType": "S"
},
{
"AttributeName": "CreatedAt",
"AttributeType": "N"
},
{
"AttributeName": "UpdatedAt",
"AttributeType": "N"
},
{
"AttributeName": "Status",
"AttributeType": "S"
},
{
"AttributeName": "Appid",
"AttributeType": "N"
}
],
"GlobalSecondaryIndexes": [
{
"IndexName": "GSI-DeviceId-1",
"KeySchema": [
{
"AttributeName": "DeviceId",
"KeyType": "HASH"
},
{
"AttributeName": "CreatedAt",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
},
{
"IndexName": "GSI-DeviceId-2",
"KeySchema": [
{
"AttributeName": "DeviceId",
"KeyType": "HASH"
},
{
"AttributeName": "UpdatedAt",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
},
{
"IndexName": "GSI-DeviceId-3",
"KeySchema": [
{
"AttributeName": "DeviceId",
"KeyType": "HASH"
},
{
"AttributeName": "Status",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
},
{
"IndexName": "GSI-Appid-1",
"KeySchema": [
{
"AttributeName": "Appid",
"KeyType": "HASH"
},
{
"AttributeName": "MessageId",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
],
"BillingMode": "PROVISIONED",
"TableName": "Messages",
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
},
"DependsOn": "Users"
},
"TableMessagesReadCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages",
"ScalableDimension": "dynamodb:table:ReadCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesReadCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesReadCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages",
"ScalableDimension": "dynamodb:table:ReadCapacityUnits",
"PolicyName": "Messages-read-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBReadCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableMessagesWriteCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages",
"ScalableDimension": "dynamodb:table:WriteCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesWriteCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesWriteCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages",
"ScalableDimension": "dynamodb:table:WriteCapacityUnits",
"PolicyName": "Messages-write-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBWriteCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableMessagesIndexGSIDeviceId1ReadCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-1",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesIndexGSIDeviceId1ReadCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesIndexGSI-DeviceId-1ReadCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-1",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"PolicyName": "Messages-index-GSI-DeviceId-1-read-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBReadCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableMessagesIndexGSIDeviceId1WriteCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-1",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesIndexGSIDeviceId1WriteCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesIndexGSI-DeviceId-1WriteCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-1",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"PolicyName": "Messages-index-GSI-DeviceId-1-write-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBWriteCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableMessagesIndexGSIDeviceId2ReadCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-2",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesIndexGSIDeviceId2ReadCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesIndexGSI-DeviceId-2ReadCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-2",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"PolicyName": "Messages-index-GSI-DeviceId-2-read-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBReadCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableMessagesIndexGSIDeviceId2WriteCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-2",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesIndexGSIDeviceId2WriteCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesIndexGSI-DeviceId-2WriteCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-2",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"PolicyName": "Messages-index-GSI-DeviceId-2-write-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBWriteCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableMessagesIndexGSIDeviceId3ReadCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-3",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesIndexGSIDeviceId3ReadCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesIndexGSI-DeviceId-3ReadCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-3",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"PolicyName": "Messages-index-GSI-DeviceId-3-read-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBReadCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableMessagesIndexGSIDeviceId3WriteCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-3",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesIndexGSIDeviceId3WriteCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesIndexGSI-DeviceId-3WriteCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-DeviceId-3",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"PolicyName": "Messages-index-GSI-DeviceId-3-write-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBWriteCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableMessagesIndexGSIAppid1ReadCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-Appid-1",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesIndexGSIAppid1ReadCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesIndexGSI-Appid-1ReadCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-Appid-1",
"ScalableDimension": "dynamodb:index:ReadCapacityUnits",
"PolicyName": "Messages-index-GSI-Appid-1-read-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBReadCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
},
"TableMessagesIndexGSIAppid1WriteCapacityScalableTarget": {
"Type": "AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn": "Messages",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-Appid-1",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"MinCapacity": 1,
"MaxCapacity": 10,
"RoleARN": {
"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
}
}
},
"TableMessagesIndexGSIAppid1WriteCapacityScalingPolicy": {
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
"DependsOn": "TableMessagesIndexGSI-Appid-1WriteCapacityScalableTarget",
"Properties": {
"ServiceNamespace": "dynamodb",
"ResourceId": "table/Messages/index/GSI-Appid-1",
"ScalableDimension": "dynamodb:index:WriteCapacityUnits",
"PolicyName": "Messages-index-GSI-Appid-1-write-capacity-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"TargetTrackingScalingPolicyConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "DynamoDBWriteCapacityUtilization"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 60,
"TargetValue": 70
}
}
}
}
}
@chrscole
Copy link

chrscole commented Mar 16, 2023

AWS CLI cannot take CF json templates as is. You will need to remove some of the CF specific objects. revised:

{
      "KeySchema": [
          {
            "AttributeName": "AppId",
            "KeyType": "HASH"
          },
          {
            "AttributeName": "ApiKey",
            "KeyType": "RANGE"
          }
        ],
        "AttributeDefinitions": [
          {
            "AttributeName": "AppId",
            "AttributeType": "N"
          },
          {
            "AttributeName": "ApiKey",
            "AttributeType": "S"
          },
          {
            "AttributeName": "Email",
            "AttributeType": "S"
          },
          {
            "AttributeName": "Password",
            "AttributeType": "S"
          }
        ],
        "GlobalSecondaryIndexes": [
          {
            "IndexName": "GSI-Email-1",
            "KeySchema": [
              {
                "AttributeName": "Email",
                "KeyType": "HASH"
              },
              {
                "AttributeName": "Password",
                "KeyType": "RANGE"
              }
            ],
            "Projection": {
              "ProjectionType": "ALL"
            },
            "ProvisionedThroughput": {
              "ReadCapacityUnits": 1,
              "WriteCapacityUnits": 1
            }
          }
        ],
        "BillingMode": "PROVISIONED",
        "TableName": "Users",
        "ProvisionedThroughput": {
          "ReadCapacityUnits": 1,
          "WriteCapacityUnits": 1
        }
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment