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
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
resource "aws_amplify_domain_association" "tdomain" {
app_id = aws_amplify_app.app.id
domain_name = var.DomainName
# https://example.com
sub_domain {
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 toPENDING_DEPLOYMENT
orAVAILABLE
. Setting this tofalse
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
Type: AWS::Amplify::Domain
Properties:
AppId: !GetAtt Frontend.AppId
DomainName: !Ref dnsName
SubDomainSettings:
- BranchName: master
# Type: 'AWS::Amplify::Domain'
# Properties:
# DomainName: !Ref 'DomainNameParameter'
# AppId: !GetAtt 'AmplifyApp.AppId'
# SubDomainSettings:
# - Prefix: 'staging'
Type: AWS::Amplify::Domain
Properties:
DomainName: !Ref DomainName
AppId: !GetAtt AmplifyApp.AppId
SubDomainSettings:
- Prefix: master
Type: AWS::Amplify::Domain
Condition: UseCustomDomain
Properties:
DomainName: !Ref Domain
AppId: !GetAtt AmplifyApp.AppId
SubDomainSettings:
Type: AWS::Amplify::Domain
Condition: UseCustomDomain
Properties:
DomainName: !Ref Domain
AppId: !GetAtt AmplifyApp.AppId
SubDomainSettings:
"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",
"AWS::Amplify::Domain": {
"Type": "AWS::Amplify::Domain",
"Properties": {}
},
"AWS::DevOpsGuru::ResourceCollection": {
"Type": "AWS::DevOpsGuru::ResourceCollection",
"resourceType": "AWS::Amplify::Domain",
"filePath": null
}
]
},
{
Parameters
-
AppId
required - String -
AutoSubDomainCreationPatterns
optional - List -
AutoSubDomainIAMRole
optional - String -
DomainName
required - String -
EnableAutoSubDomain
optional - Boolean -
SubDomainSettings
required - List of SubDomainSetting
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.