LoginSignup
0
0

More than 3 years have passed since last update.

CloudFormationでS3とDynamDBを作成する

Last updated at Posted at 2020-10-25

S3のテンプレートは以下になります。

create_s3.yaml
AWSTemplateFormatVersion: 2010-09-09
Resources:
  S3Bucket:
    Type: AWS::S3::Bucket

DynamoDBのテンプレートは以下になります。

create_ddb.yaml
Resources:
  DDBTable:
    Type: AWS::DynamoDB::Table
    Properties:
      AttributeDefinitions:
        - AttributeName: "ArtistId"
          AttributeType: "S"
      KeySchema:
        - AttributeName: "ArtistId"
          KeyType: "HASH"
      ProvisionedThroughput:
        ReadCapacityUnits: 5
        WriteCapacityUnits: 5

スタックの作成と削除は以下のコマンドでおこないます。

create-s3
aws cloudformation deploy --template-file create_s3.yml --stack-name my-s3
create-ddb
aws cloudformation deploy --template-file create_ddb.yml --stack-name my-ddb
delete-s3
aws cloudformation delete-stack --stack-name my-s3 
delete-ddb
aws cloudformation delete-stack --stack-name my-ddb

最後まで読んでいただきありがとうございました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0