相关疑难解决方法(0)

CloudFormation坚持认为我的DynamoDB创建JSON无效..但我看不出如何

这是我的Troposphere生成的JSON的(DynamoDB部分):

"sandbox": {
        "Properties": {
            "AttributeDefinitions": [
                {
                    "AttributeName": "audit_id",
                    "AttributeType": "S"
                },
                {
                    "AttributeName": "status",
                    "AttributeType": "S"
                },
                {
                    "AttributeName": "filename",
                    "AttributeType": "S"
                },
                {
                    "AttributeName": "file_detected_dt",
                    "AttributeType": "S"
                },
                {
                    "AttributeName": "time_taken",
                    "AttributeType": "N"
                },
                {
                    "AttributeName": "number_rows_processed_file",
                    "AttributeType": "N"
                },
                {
                    "AttributeName": "number_rows_created_db",
                    "AttributeType": "N"
                },
                {
                    "AttributeName": "info_messages",
                    "AttributeType": "S"
                }
            ],
            "KeySchema": [
                {
                    "AttributeName": "audit_id",
                    "KeyType": "HASH"
                }
            ],
            "ProvisionedThroughput": {
                "ReadCapacityUnits": {
                    "Ref": "ReadCapacityUnits"
                },
                "WriteCapacityUnits": {
                    "Ref": "WriteCapacityUnits"
                }
            }
        },
        "Type": …
Run Code Online (Sandbox Code Playgroud)

aws-cloudformation amazon-dynamodb

80
推荐指数
1
解决办法
1万
查看次数

如何在DynamoDB中添加列

有没有办法在Amazon的AWS中的DynamoDB中向现有表添加新列?

谷歌没有帮助,

http://docs.aws.amazon.com/cli/latest/reference/dynamodb/update-table.html?highlight=update%20table中的UpdateTable查询没有任何与添加新列相关的信息.

amazon-web-services nosql amazon-dynamodb

55
推荐指数
2
解决办法
4万
查看次数

带有排序键的无服务器框架Dynamo DB表资源定义

我目前在我的serverless.yml中有一些代码.

resources:
  Resources:
    uploadBucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: ${self:service}-${self:custom.stage}-uploads
    visitsTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: ${self:custom.visitsTable}
        AttributeDefinitions:
          - AttributeName: userId
            AttributeType: S
          - AttributeName: visitId
            AttributeType: S
          - AttributeName: comments
            AttributeType: S
          - AttributeName: attachments
            AttributeType: S
          - AttributeName: ph
            AttributeType: N
          - AttributeName: ch
            AttributeType: N
        KeySchema:
          - AttributeName: userId
            KeyType: HASH
          - AttributeName: visitId
            KeyType: HASH
        ProvisionedThroughput:
            ReadCapacityUnits: 5
            WriteCapacityUnits: 5
Run Code Online (Sandbox Code Playgroud)

我的目标是创建一个包含主键userId,排序键visitId的表,并包含注释,附件,ph&ch的字段.当我尝试时,sls deploy我得到以下错误.

无服务器错误---------------------------------------

发生错误:visitsTable - 属性AttributeDefinitions与表的KeySchema和二级索引不一致.

我在这做错了什么?

编辑:我试过的另一次尝试

resources:
  Resources:
    uploadBucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: ${self:service}-${self:custom.stage}-uploads …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-dynamodb serverless-framework

6
推荐指数
1
解决办法
5360
查看次数