Help us understand the problem. What is going on with this article?

CloudFormationでDynamoDB作成時にハマったこと

More than 1 year has passed since last update.

AWSのリファレンスを読みながら作成したのに、少しハマったので・・

最初に書いたコード

  • 実行してもDynamoDBが作成されません
yaml
---
AWSTemplateFormatVersion: 2010-09-09
Description: DynamoDB Crete
Parameters:
  TableName:
    Type: String
    Description: DDB Table Name
Resources:
  DDBTable:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: !Ref TableName
      AttributeDefinitions:
        -
          AttributeName: CreatedId
          AttributeType: S
      KeySchema:
        -
          AttributeName: CreatedId
          KeyType: HASH
Outputs:
  DynamoDBTableName:
    Value:
      !Ref DDBTable
    Description: DynamoDB Table Name
  • プロパティで「必須:はい」のものを全て指定してもうまく実行されない
  • スクリーンショット 2019-03-31 0.45.58.png

よく読んだら、デフォルトで入る値によって、必須となるパラメータがあった

  • BillingModeがデフォルトでPROVISIONEDに設定され、その設定の場合、ProvisionedThroughtputの記述が必須になる
  • スクリーンショット 2019-03-31 0.48.29.png
  • スクリーンショット 2019-03-31 0.49.43.png

正しいコード

  • うまくいった
yaml
---
AWSTemplateFormatVersion: 2010-09-09
Description: DynamoDB Crete
Parameters:
  TableName:
    Type: String
    Description: DDB Table Name
Resources:
  DDBTable:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: !Ref TableName
      AttributeDefinitions:
        -
          AttributeName: CreatedId
          AttributeType: S
      KeySchema:
        -
          AttributeName: CreatedId
          KeyType: HASH
      ProvisionedThroughput:
        ReadCapacityUnits: 3
        WriteCapacityUnits: 3
Outputs:
  DynamoDBTableName:
    Value:
      !Ref DDBTable
    Description: DynamoDB Table Name
fkana
色彩検定1級/カラーコーディネーター1級-商品色彩分野-/UX Director(もしくはService Designer)
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした