The page has been translated by Gen AI.

DNS

Register A record in public domain (Public Hosted Zone, A record)

Create a public hosted zone and add an A record.

  • All parameters have default values, but DomainName must be a public domain registered with the DNS service.
  • Enter the domain or subdomain of the hosted zone in RecordName.
  • The TTL of an A record is set to 300 seconds.
Color mode
SCPTemplateFormatVersion: '2026-01-01'
Description: 'DNS sample template that creates a Public Hosted Zone and adds an A record'

Parameters:
  DomainName:
    Type: String
    Default: 'example.com'
    Description: 'Enter the public domain name registered in the DNS service. (2~69 characters, e.g., example.com)
  RecordName:
    Type: String
    Default: 'www.example.com'
    Description: 'Enter the name of the A record to create.' Enter the domain or subdomain of the hosted zone. (e.g., www.example.com)
  RecordIpAddress:
    Type: String
    Default: '203.0.113.10'
    Description: 'Enter the IPv4 address to associate with the A record. (e.g., 203.0.113.10)

Resources:
  hostedzone:
    Type: SCP::Dns::HostedZone
    Properties:
      Name: !Ref DomainName
      Type: public

  record:
    Type: SCP::Dns::Record
    Properties:
      HostedZoneId: !Ref hostedzone
      Name: !Ref RecordName
      Type: A
      Records:
        - !Ref RecordIpAddress
      Ttl: 300

Outputs:
  HostedZoneId:
    Description: 'The ID of the created hosting zone (Public Hosted Zone).'
    Value: !Ref hostedzone
  RecordId:
    Description: 'The ID of the generated DNS record.'
    Value: !Ref record
SCPTemplateFormatVersion: '2026-01-01'
Description: 'DNS sample template that creates a Public Hosted Zone and adds an A record'

Parameters:
  DomainName:
    Type: String
    Default: 'example.com'
    Description: 'Enter the public domain name registered in the DNS service. (2~69 characters, e.g., example.com)
  RecordName:
    Type: String
    Default: 'www.example.com'
    Description: 'Enter the name of the A record to create.' Enter the domain or subdomain of the hosted zone. (e.g., www.example.com)
  RecordIpAddress:
    Type: String
    Default: '203.0.113.10'
    Description: 'Enter the IPv4 address to associate with the A record. (e.g., 203.0.113.10)

Resources:
  hostedzone:
    Type: SCP::Dns::HostedZone
    Properties:
      Name: !Ref DomainName
      Type: public

  record:
    Type: SCP::Dns::Record
    Properties:
      HostedZoneId: !Ref hostedzone
      Name: !Ref RecordName
      Type: A
      Records:
        - !Ref RecordIpAddress
      Ttl: 300

Outputs:
  HostedZoneId:
    Description: 'The ID of the created hosting zone (Public Hosted Zone).'
    Value: !Ref hostedzone
  RecordId:
    Description: 'The ID of the generated DNS record.'
    Value: !Ref record
Code block. Register an A record in the public domain (Public Hosted Zone, A record) template
Load Balancer
Financial Management