View a markdown version of this page

AWS::AmplifyGen3::DomainAssociation - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

This is the new Amazon CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the Amazon CloudFormation User Guide.

AWS::AmplifyGen3::DomainAssociation

The AWS::AmplifyGen3::DomainAssociation resource specifies a custom domain for an Amazon Amplify Gen 3 app, and how the domain routes traffic.

Syntax

To declare this entity in your Amazon CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::AmplifyGen3::DomainAssociation", "Properties" : { "AppName" : String, "DnsManagementType" : String, "DomainName" : String, "Routing" : Routing, "Tags" : [ Tag, ... ] } }

YAML

Type: AWS::AmplifyGen3::DomainAssociation Properties: AppName: String DnsManagementType: String DomainName: String Routing: Routing Tags: - Tag

Properties

AppName

The name of the app.

Required: Yes

Type: String

Minimum: 1

Maximum: 40

Update requires: Replacement

DnsManagementType

Specifies who manages the DNS records for the domain. Valid values:

  • ROUTE_53: Amazon Amplify Gen 3 creates the records in an Amazon Route 53 hosted zone in your account.

  • MANUAL: You create the records with your DNS provider.

  • NS_DELEGATION: Amazon Amplify Gen 3 creates a hosted zone, and you delegate the domain to its name servers.

Required: Yes

Type: String

Allowed values: ROUTE_53 | MANUAL | NS_DELEGATION

Update requires: Replacement

DomainName

The fully qualified domain name.

Required: Yes

Type: String

Pattern: ^([a-z0-9]([a-z0-9-]*[a-z0-9])?\.){1,31}[a-z]{2,}$

Minimum: 4

Maximum: 64

Update requires: Replacement

Routing

The routing configuration for the domain.

Required: Yes

Type: Routing

Update requires: No interruption

Tags

An array of key-value pairs to apply to this resource.

For more information, see Tag.

Required: No

Type: Array of Tag

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the ARN of the domain association.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

CreatedAt

The time at which the domain association was created. The value is in ISO-8601 format.

DomainAssociationArn

The Amazon Resource Name (ARN) of the domain association.

Remarks

Amazon CloudFormation reports CREATE_COMPLETE for this resource as soon as Amazon Amplify Gen 3 accepts the domain association. It doesn't wait for the domain to become ACTIVE.

With DnsManagementType set to MANUAL or NS_DELEGATION, the domain stays in a PENDING_ status, such as PENDING_DNS_VALIDATION or PENDING_NS_DELEGATION, until you finish the DNS setup with your DNS provider. Until then, the domain doesn't serve traffic, even though the stack operation succeeded.

Examples

Create a custom domain that redirects

The following example associates the domain www.example.com with an app and redirects its traffic to another URL. The DNS records are managed manually.

JSON

{ "Resources": { "MyDomain": { "Type": "AWS::AmplifyGen3::DomainAssociation", "Properties": { "AppName": "my-app", "DomainName": "www.example.com", "DnsManagementType": "MANUAL", "Routing": { "Redirect": { "TargetUrl": "https://example.com/welcome", "StatusCode": "HTTP_302" } } } } } }

YAML

Resources: MyDomain: Type: AWS::AmplifyGen3::DomainAssociation Properties: AppName: my-app DomainName: www.example.com DnsManagementType: MANUAL Routing: Redirect: TargetUrl: https://example.com/welcome StatusCode: HTTP_302