class CnameInstance (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.ServiceDiscovery.CnameInstance |
![]() | software.amazon.awscdk.services.servicediscovery.CnameInstance |
![]() | aws_cdk.aws_servicediscovery.CnameInstance |
![]() | @aws-cdk/aws-servicediscovery » CnameInstance |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IInstance
Instance that is accessible using a domain name (CNAME).
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as servicediscovery from '@aws-cdk/aws-servicediscovery';
declare const service: servicediscovery.Service;
const cnameInstance = new servicediscovery.CnameInstance(this, 'MyCnameInstance', {
instanceCname: 'instanceCname',
service: service,
// the properties below are optional
customAttributes: {
customAttributesKey: 'customAttributes',
},
instanceId: 'instanceId',
});
Initializer
new CnameInstance(scope: Construct, id: string, props: CnameInstanceProps)
Parameters
- scope
Construct
- id
string
- props
Cname
Instance Props
Construct Props
Name | Type | Description |
---|---|---|
instance | string | If the service configuration includes a CNAME record, the domain name that you want Route 53 to return in response to DNS queries, for example, example.com. This value is required if the service specified by ServiceId includes settings for an CNAME record. |
service | IService | The Cloudmap service this resource is registered to. |
custom | { [string]: string } | Custom attributes of the instance. |
instance | string | The id of the instance resource. |
instanceCname
Type:
string
If the service configuration includes a CNAME record, the domain name that you want Route 53 to return in response to DNS queries, for example, example.com. This value is required if the service specified by ServiceId includes settings for an CNAME record.
service
Type:
IService
The Cloudmap service this resource is registered to.
customAttributes?
Type:
{ [string]: string }
(optional, default: none)
Custom attributes of the instance.
instanceId?
Type:
string
(optional, default: Automatically generated name)
The id of the instance resource.
Properties
Name | Type | Description |
---|---|---|
cname | string | The domain name returned by DNS queries for the instance. |
env | Resource | The environment this resource belongs to. |
instance | string | The Id of the instance. |
node | Construct | The construct tree node associated with this construct. |
service | IService | The Cloudmap service to which the instance is registered. |
stack | Stack | The stack in which this resource is defined. |
cname
Type:
string
The domain name returned by DNS queries for the instance.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
instanceId
Type:
string
The Id of the instance.
node
Type:
Construct
The construct tree node associated with this construct.
service
Type:
IService
The Cloudmap service to which the instance is registered.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.