1. Packages
  2. AWS
  3. API Docs
  4. apprunner
  5. CustomDomainAssociation
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.apprunner.CustomDomainAssociation

Explore with Pulumi AI

Manages an App Runner Custom Domain association.

NOTE: After creation, you must use the information in the certificate_validation_records attribute to add CNAME records to your Domain Name System (DNS). For each mapped domain name, add a mapping to the target App Runner subdomain (found in the dns_target attribute) and one or more certificate validation records. App Runner then performs DNS validation to verify that you own or control the domain name you associated. App Runner tracks domain validity in a certificate stored in AWS Certificate Manager (ACM).

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.apprunner.CustomDomainAssociation("example", {
    domainName: "example.com",
    serviceArn: exampleAwsApprunnerService.arn,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.apprunner.CustomDomainAssociation("example",
    domain_name="example.com",
    service_arn=example_aws_apprunner_service["arn"])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apprunner"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := apprunner.NewCustomDomainAssociation(ctx, "example", &apprunner.CustomDomainAssociationArgs{
			DomainName: pulumi.String("example.com"),
			ServiceArn: pulumi.Any(exampleAwsApprunnerService.Arn),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.AppRunner.CustomDomainAssociation("example", new()
    {
        DomainName = "example.com",
        ServiceArn = exampleAwsApprunnerService.Arn,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apprunner.CustomDomainAssociation;
import com.pulumi.aws.apprunner.CustomDomainAssociationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new CustomDomainAssociation("example", CustomDomainAssociationArgs.builder()
            .domainName("example.com")
            .serviceArn(exampleAwsApprunnerService.arn())
            .build());

    }
}
Copy
resources:
  example:
    type: aws:apprunner:CustomDomainAssociation
    properties:
      domainName: example.com
      serviceArn: ${exampleAwsApprunnerService.arn}
Copy

Create CustomDomainAssociation Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new CustomDomainAssociation(name: string, args: CustomDomainAssociationArgs, opts?: CustomResourceOptions);
@overload
def CustomDomainAssociation(resource_name: str,
                            args: CustomDomainAssociationArgs,
                            opts: Optional[ResourceOptions] = None)

@overload
def CustomDomainAssociation(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            domain_name: Optional[str] = None,
                            service_arn: Optional[str] = None,
                            enable_www_subdomain: Optional[bool] = None)
func NewCustomDomainAssociation(ctx *Context, name string, args CustomDomainAssociationArgs, opts ...ResourceOption) (*CustomDomainAssociation, error)
public CustomDomainAssociation(string name, CustomDomainAssociationArgs args, CustomResourceOptions? opts = null)
public CustomDomainAssociation(String name, CustomDomainAssociationArgs args)
public CustomDomainAssociation(String name, CustomDomainAssociationArgs args, CustomResourceOptions options)
type: aws:apprunner:CustomDomainAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. CustomDomainAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. CustomDomainAssociationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. CustomDomainAssociationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. CustomDomainAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. CustomDomainAssociationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var customDomainAssociationResource = new Aws.AppRunner.CustomDomainAssociation("customDomainAssociationResource", new()
{
    DomainName = "string",
    ServiceArn = "string",
    EnableWwwSubdomain = false,
});
Copy
example, err := apprunner.NewCustomDomainAssociation(ctx, "customDomainAssociationResource", &apprunner.CustomDomainAssociationArgs{
	DomainName:         pulumi.String("string"),
	ServiceArn:         pulumi.String("string"),
	EnableWwwSubdomain: pulumi.Bool(false),
})
Copy
var customDomainAssociationResource = new CustomDomainAssociation("customDomainAssociationResource", CustomDomainAssociationArgs.builder()
    .domainName("string")
    .serviceArn("string")
    .enableWwwSubdomain(false)
    .build());
Copy
custom_domain_association_resource = aws.apprunner.CustomDomainAssociation("customDomainAssociationResource",
    domain_name="string",
    service_arn="string",
    enable_www_subdomain=False)
Copy
const customDomainAssociationResource = new aws.apprunner.CustomDomainAssociation("customDomainAssociationResource", {
    domainName: "string",
    serviceArn: "string",
    enableWwwSubdomain: false,
});
Copy
type: aws:apprunner:CustomDomainAssociation
properties:
    domainName: string
    enableWwwSubdomain: false
    serviceArn: string
Copy

CustomDomainAssociation Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The CustomDomainAssociation resource accepts the following input properties:

DomainName
This property is required.
Changes to this property will trigger replacement.
string
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
ServiceArn
This property is required.
Changes to this property will trigger replacement.
string
ARN of the App Runner service.
EnableWwwSubdomain Changes to this property will trigger replacement. bool
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
DomainName
This property is required.
Changes to this property will trigger replacement.
string
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
ServiceArn
This property is required.
Changes to this property will trigger replacement.
string
ARN of the App Runner service.
EnableWwwSubdomain Changes to this property will trigger replacement. bool
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
domainName
This property is required.
Changes to this property will trigger replacement.
String
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
serviceArn
This property is required.
Changes to this property will trigger replacement.
String
ARN of the App Runner service.
enableWwwSubdomain Changes to this property will trigger replacement. Boolean
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
domainName
This property is required.
Changes to this property will trigger replacement.
string
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
serviceArn
This property is required.
Changes to this property will trigger replacement.
string
ARN of the App Runner service.
enableWwwSubdomain Changes to this property will trigger replacement. boolean
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
domain_name
This property is required.
Changes to this property will trigger replacement.
str
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
service_arn
This property is required.
Changes to this property will trigger replacement.
str
ARN of the App Runner service.
enable_www_subdomain Changes to this property will trigger replacement. bool
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
domainName
This property is required.
Changes to this property will trigger replacement.
String
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
serviceArn
This property is required.
Changes to this property will trigger replacement.
String
ARN of the App Runner service.
enableWwwSubdomain Changes to this property will trigger replacement. Boolean
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.

Outputs

All input properties are implicitly available as output properties. Additionally, the CustomDomainAssociation resource produces the following output properties:

CertificateValidationRecords List<CustomDomainAssociationCertificateValidationRecord>
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
DnsTarget string
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
Id string
The provider-assigned unique ID for this managed resource.
Status string
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
CertificateValidationRecords []CustomDomainAssociationCertificateValidationRecord
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
DnsTarget string
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
Id string
The provider-assigned unique ID for this managed resource.
Status string
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
certificateValidationRecords List<CustomDomainAssociationCertificateValidationRecord>
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
dnsTarget String
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
id String
The provider-assigned unique ID for this managed resource.
status String
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
certificateValidationRecords CustomDomainAssociationCertificateValidationRecord[]
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
dnsTarget string
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
id string
The provider-assigned unique ID for this managed resource.
status string
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
certificate_validation_records Sequence[CustomDomainAssociationCertificateValidationRecord]
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
dns_target str
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
id str
The provider-assigned unique ID for this managed resource.
status str
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
certificateValidationRecords List<Property Map>
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
dnsTarget String
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
id String
The provider-assigned unique ID for this managed resource.
status String
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.

Look up Existing CustomDomainAssociation Resource

Get an existing CustomDomainAssociation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: CustomDomainAssociationState, opts?: CustomResourceOptions): CustomDomainAssociation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        certificate_validation_records: Optional[Sequence[CustomDomainAssociationCertificateValidationRecordArgs]] = None,
        dns_target: Optional[str] = None,
        domain_name: Optional[str] = None,
        enable_www_subdomain: Optional[bool] = None,
        service_arn: Optional[str] = None,
        status: Optional[str] = None) -> CustomDomainAssociation
func GetCustomDomainAssociation(ctx *Context, name string, id IDInput, state *CustomDomainAssociationState, opts ...ResourceOption) (*CustomDomainAssociation, error)
public static CustomDomainAssociation Get(string name, Input<string> id, CustomDomainAssociationState? state, CustomResourceOptions? opts = null)
public static CustomDomainAssociation get(String name, Output<String> id, CustomDomainAssociationState state, CustomResourceOptions options)
resources:  _:    type: aws:apprunner:CustomDomainAssociation    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CertificateValidationRecords List<CustomDomainAssociationCertificateValidationRecord>
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
DnsTarget string
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
DomainName Changes to this property will trigger replacement. string
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
EnableWwwSubdomain Changes to this property will trigger replacement. bool
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
ServiceArn Changes to this property will trigger replacement. string
ARN of the App Runner service.
Status string
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
CertificateValidationRecords []CustomDomainAssociationCertificateValidationRecordArgs
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
DnsTarget string
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
DomainName Changes to this property will trigger replacement. string
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
EnableWwwSubdomain Changes to this property will trigger replacement. bool
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
ServiceArn Changes to this property will trigger replacement. string
ARN of the App Runner service.
Status string
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
certificateValidationRecords List<CustomDomainAssociationCertificateValidationRecord>
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
dnsTarget String
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
domainName Changes to this property will trigger replacement. String
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
enableWwwSubdomain Changes to this property will trigger replacement. Boolean
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
serviceArn Changes to this property will trigger replacement. String
ARN of the App Runner service.
status String
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
certificateValidationRecords CustomDomainAssociationCertificateValidationRecord[]
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
dnsTarget string
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
domainName Changes to this property will trigger replacement. string
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
enableWwwSubdomain Changes to this property will trigger replacement. boolean
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
serviceArn Changes to this property will trigger replacement. string
ARN of the App Runner service.
status string
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
certificate_validation_records Sequence[CustomDomainAssociationCertificateValidationRecordArgs]
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
dns_target str
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
domain_name Changes to this property will trigger replacement. str
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
enable_www_subdomain Changes to this property will trigger replacement. bool
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
service_arn Changes to this property will trigger replacement. str
ARN of the App Runner service.
status str
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
certificateValidationRecords List<Property Map>
A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
dnsTarget String
App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
domainName Changes to this property will trigger replacement. String
Custom domain endpoint to association. Specify a base domain e.g., example.com or a subdomain e.g., subdomain.example.com.
enableWwwSubdomain Changes to this property will trigger replacement. Boolean
Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
serviceArn Changes to this property will trigger replacement. String
ARN of the App Runner service.
status String
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.

Supporting Types

CustomDomainAssociationCertificateValidationRecord
, CustomDomainAssociationCertificateValidationRecordArgs

Name string
Certificate CNAME record name.
Status string
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
Type string
Record type, always CNAME.
Value string
Certificate CNAME record value.
Name string
Certificate CNAME record name.
Status string
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
Type string
Record type, always CNAME.
Value string
Certificate CNAME record value.
name String
Certificate CNAME record name.
status String
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
type String
Record type, always CNAME.
value String
Certificate CNAME record value.
name string
Certificate CNAME record name.
status string
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
type string
Record type, always CNAME.
value string
Certificate CNAME record value.
name str
Certificate CNAME record name.
status str
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
type str
Record type, always CNAME.
value str
Certificate CNAME record value.
name String
Certificate CNAME record name.
status String
Current state of the certificate CNAME record validation. It should change to SUCCESS after App Runner completes validation with your DNS.
type String
Record type, always CNAME.
value String
Certificate CNAME record value.

Import

Using pulumi import, import App Runner Custom Domain Associations using the domain_name and service_arn separated by a comma (,). For example:

$ pulumi import aws:apprunner/customDomainAssociation:CustomDomainAssociation example example.com,arn:aws:apprunner:us-east-1:123456789012:service/example-app/8fe1e10304f84fd2b0df550fe98a71fa
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.