AWS Amplify Console Domain Association

This page shows how to write Terraform and CloudFormation for Amplify Console Domain Association and write them securely.

aws_amplify_domain_association (Terraform)

The Domain Association in Amplify Console can be configured in Terraform with the resource name aws_amplify_domain_association. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

amplify-domains.tf#L1
resource "aws_amplify_domain_association" "example" {
  app_id      = aws_amplify_app.testofamplify.id
  domain_name = var.domain_name

  sub_domain {
    branch_name = aws_amplify_branch.master.branch_name
main.tf#L35
resource "aws_amplify_domain_association" "tdomain" {
  app_id      = aws_amplify_app.app.id
  domain_name = var.DomainName

  # https://example.com
  sub_domain {

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The following arguments are supported:

  • app_id - (Required) The unique ID for an Amplify app.
  • domain_name - (Required) The domain name for the domain association.
  • sub_domain - (Required) The setting for the subdomain. Documented below.
  • wait_for_verification - (Optional) If enabled, the resource will wait for the domain association status to change to PENDING_DEPLOYMENT or AVAILABLE. Setting this to false will skip the process. Default: true.

The sub_domain configuration block supports the following arguments:

  • branch_name - (Required) The branch name setting for the subdomain.
  • prefix - (Required) The prefix setting for the subdomain.

In addition to all arguments above, the following attributes are exported:

  • arn - The Amazon Resource Name (ARN) for the domain association.
  • certificate_verification_dns_record - The DNS record for certificate verification.

The sub_domain configuration block exports the following attributes:

  • dns_record - The DNS record for the subdomain.
  • verified - The verified status of the subdomain.

Explanation in Terraform Registry

Provides an Amplify Domain Association resource.

AWS::Amplify::Domain (CloudFormation)

The Domain in Amplify can be configured in CloudFormation with the resource name AWS::Amplify::Domain. The following sections describe 8 examples of how to use the resource and its parameters.

Example Usage from GitHub

template.yml#L89
    Type: AWS::Amplify::Domain
    Properties:
      AppId: !GetAtt Frontend.AppId
      DomainName: !Ref dnsName
      SubDomainSettings:
        - BranchName: master
cd.yml#L83
  #   Type: 'AWS::Amplify::Domain'
  #   Properties:
  #     DomainName: !Ref 'DomainNameParameter'
  #     AppId: !GetAtt 'AmplifyApp.AppId'
  #     SubDomainSettings:
  #       - Prefix: 'staging'
pipeline.yml#L79
    Type: AWS::Amplify::Domain
    Properties:
      DomainName: !Ref DomainName
      AppId: !GetAtt AmplifyApp.AppId
      SubDomainSettings:
        - Prefix: master
stack.yml#L68
    Type: AWS::Amplify::Domain
    Condition: UseCustomDomain
    Properties:
      DomainName: !Ref Domain
      AppId: !GetAtt AmplifyApp.AppId
      SubDomainSettings:
stack.yaml#L68
    Type: AWS::Amplify::Domain
    Condition: UseCustomDomain
    Properties:
      DomainName: !Ref Domain
      AppId: !GetAtt AmplifyApp.AppId
      SubDomainSettings:
AmplifyDomainSpecification.json#L3
    "AWS::Amplify::Domain.SubDomainSetting": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplify-domain-subdomainsetting.html",
      "Properties": {
        "Prefix": {
          "Required": true,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplify-domain-subdomainsetting.html#cfn-amplify-domain-subdomainsetting-prefix",
template.json#L2679
    "AWS::Amplify::Domain": {
      "Type": "AWS::Amplify::Domain",
      "Properties": {}
    },
    "AWS::DevOpsGuru::ResourceCollection": {
      "Type": "AWS::DevOpsGuru::ResourceCollection",
awsResouceIconMatches.json#L2662
        "resourceType": "AWS::Amplify::Domain",
        "filePath": null
      }
    ]
  },
  {

Parameters

Explanation in CloudFormation Registry

The AWS::Amplify::Domain resource allows you to connect a custom domain to your app.

Frequently asked questions

What is AWS Amplify Console Domain Association?

AWS Amplify Console Domain Association is a resource for Amplify Console of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amplify Console Domain Association?

For Terraform, the naoyahieda/terraform_amplify_cicd_example and amalneoito/TestLogin source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the dtelaroli/devops-test, claptime/claptime and santerisalonen/amplify-test source code examples are useful. See the CloudFormation Example section for further details.