`
sillycat
  • 浏览: 2566635 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

AMAZON DynamoDB(6)Autoscaling Configuration

 
阅读更多
AMAZON DynamoDB(6)Autoscaling Configuration

We use Serverless framework to deploy our Lambda, so we can try to configuration the auto scaling for DynamoDB there.

I firstly want to do that on serverless.yml. I do the follow changes in serverless.yml
ddbCapaciies:
    read:
        int:
          min: 1
          max: 5
        stage:
          min: 5
          max: 10
        prod:
          min: 10
          max: 500
    write:
        int:
          min: 1
          max: 5
        stage:
          min: 5
          max: 10
        prod:
          min: 10
          max: 500
  capacities:
    - table: DevicePairingInfoTable  # DynamoDB Resource
      read:
        minimum: ${self:custom.ddbCapaciies.read.${self:custom.stage}.min}        # Minimum read capacity
        maximum: ${self:custom.ddbCapaciies.read.${self:custom.stage}.max}     # Maximum read capacity
        usage: 0.80       # Targeted usage percentage
      write:
        minimum: ${self:custom.ddbCapaciies.write.${self:custom.stage}.min}       # Minimum write capacity
        maximum: ${self:custom.ddbCapaciies.write.${self:custom.stage}.min}      # Maximum write capacity
        usage: 0.80        # Targeted usage percentage
    PairingCodeTable:
      Type: AWS::DynamoDB::Table
      DeletionPolicy: Retain
      Properties:
        TableName: ${self:custom.dbPairingCodeName}
        AttributeDefinitions:
          - AttributeName: pairingCode
            AttributeType: S
          - AttributeName: serialNumber
            AttributeType: S
          - AttributeName: platform
            AttributeType: S
        KeySchema:
          - AttributeName: pairingCode
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: ${self:custom.ddbCapaciies.read.${self:custom.stage}.min}
          WriteCapacityUnits: ${self:custom.ddbCapaciies.write.${self:custom.stage}.max}
        GlobalSecondaryIndexes:
          - IndexName: ${self:custom.dbPairingCodeSerialIndex}
            KeySchema:
              - AttributeName: serialNumber
                KeyType: HASH
            Projection:
              ProjectionType: ALL
            ProvisionedThroughput:
              ReadCapacityUnits: ${self:custom.ddbCapaciies.read.${self:custom.stage}.min}
              WriteCapacityUnits: ${self:custom.ddbCapaciies.write.${self:custom.stage}.max}
          - IndexName: ${self:custom.dbPairingCodePlatformIndex}
            KeySchema:
              - AttributeName: platform
                KeyType: HASH
            Projection:
              ProjectionType: ALL
            ProvisionedThroughput:
              ReadCapacityUnits: ${self:custom.ddbCapaciies.read.${self:custom.stage}.min}
              WriteCapacityUnits: ${self:custom.ddbCapaciies.write.${self:custom.stage}.max}

But when I deploy that I get an error with table already exists. That should be because of I create the table by script, not from servless yaml.
An error occurred: xxxxxTable - xxxxxxx-int-devicePairingCode already exists.

We can only do that if the tables are created by serverless yaml at the beginning. But my table is created by my dump script. I need to check how to do that in shell script.

Follow the link
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/AutoScaling.CLI.html

Alter the AutoScaling on DynamoDB
No finished, we will currently do that from the console.


References:
https://github.com/sbstjn/serverless-dynamodb-autoscaling
https://sbstjn.com/serverless-dynamodb-auto-scaling-with-cloudformation.html
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/AutoScaling.CLI.html






分享到:
评论

相关推荐

    AWS亚马逊SAA助理架构师最新题库中文版2019最新4/20

    - **AutoScaling Launch Configuration**: 启动配置包含了实例类型、AMI、安全组等配置信息,因此在这里可以更改实例类型。 **结论**: 实例类型应在AutoScaling Launch Configuration中进行修改。 #### 题目211: ...

    SringBootAWS

    - **Amazon DynamoDB**:无服务器、高性能的NoSQL数据库,Spring Data库提供了对DynamoDB的集成支持。 - **Amazon EC2**:弹性计算云,可以运行Spring Boot应用的实例。 - **Amazon Lambda**:无服务器计算平台,...

    smmaws-live:AWS的基础结构参数

    6. **DynamoDB**:DynamoDB是AWS的NoSQL数据库服务,适合高吞吐量的应用。配置可能涉及表的创建、索引、读写容量和自动缩放设置。 7. **IAM(Identity and Access Management)**:IAM用于控制AWS资源的访问权限。...

    Terraform-and-AWS-FortiWeb:这是一个临时测试

    - 考虑到 FortiWeb 的性能和可用性,可能需要配置 AWS Auto Scaling Group 和 CloudWatch 监控。Terraform 可以定义伸缩策略和触发器,根据 CPU 使用率或其他指标动态调整实例数量。 6. **持续集成/持续部署 (CI/...

    terraform-aws

    Terraform AWS是HashiCorp Configuration Language(HCL)的一种应用,用于自动化Amazon Web Services(AWS)资源的创建、配置和管理。Terraform是一种基础设施即代码(IaC)工具,它允许开发者以声明性的方式定义云...

    terraform-3层架构

    我们可以配置Auto Scaling Group来确保应用层能够根据负载自动扩展。 3. **数据库层**: 数据库层存储和管理应用程序的数据。Terraform支持多种数据库服务,如AWS的RDS(Relational Database Service)用于MySQL、...

Global site tag (gtag.js) - Google Analytics