CloudFormation でホストゾーンとAレコードを作成する

参考

テンプレート

Aレコードの値は CloudFormation で同時に作成する ALB に設定しています。

Parameters:
  # ...(略)...
  HostedZoneName:
    Type: String
    Description: "input domain"
    Default: ""

Resources:
  # ...(略)...

  InternetALB:
  # ...(略)...

  Route53HostedZone:
    Type: AWS::Route53::HostedZone
    Properties:
      Name: !Sub "${HostedZoneName}"
  route53Record:
    Type: AWS::Route53::RecordSetGroup
    Properties:
      HostedZoneName: !Sub "${HostedZoneName}."
      Comment: ""
      RecordSets:
        - Name: !Sub "${HostedZoneName}."
          Type: A
          AliasTarget:
            HostedZoneId: !GetAtt "InternetALB.CanonicalHostedZoneID"
            DNSName: !GetAtt "InternetALB.DNSName"

一言

なんか他のブログ参考にいしたけど色々動かなかった。。

YouTube