Namespace Amazon.CDK.AWS.ServiceDiscovery
Amazon ECS Service Discovery Construct Library
---This module is part of the AWS Cloud Development Kit project.
This package contains constructs for working with AWS Cloud Map
AWS Cloud Map is a fully managed service that you can use to create and maintain a map of the backend services and resources that your applications depend on.
For further information on AWS Cloud Map, see the AWS Cloud Map documentation
HTTP Namespace Example
The following example creates an AWS Cloud Map namespace that supports API calls, creates a service in that namespace, and registers an instance to it:
using Amazon.CDK;
using Amazon.CDK.AWS.ServiceDiscovery;
var app = new App();
var stack = new Stack(app, "aws-servicediscovery-integ");
var namespace = new HttpNamespace(stack, "MyNamespace", new HttpNamespaceProps {
Name = "covfefe"
});
var service1 = namespace.CreateService("NonIpService", new BaseServiceProps {
Description = "service registering non-ip instances"
});
service1.RegisterNonIpInstance("NonIpInstance", new NonIpInstanceBaseProps {
CustomAttributes = new Dictionary<string, string> { { "arn", "arn:aws:s3:::mybucket" } }
});
var service2 = namespace.CreateService("IpService", new BaseServiceProps {
Description = "service registering ip instances",
HealthCheck = new HealthCheckConfig {
Type = HealthCheckType.HTTP,
ResourcePath = "/check"
}
});
service2.RegisterIpInstance("IpInstance", new IpInstanceBaseProps {
Ipv4 = "54.239.25.192"
});
app.Synth();
Private DNS Namespace Example
The following example creates an AWS Cloud Map namespace that supports both API calls and DNS queries within a vpc, creates a service in that namespace, and registers a loadbalancer as an instance:
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;
using Amazon.CDK;
using Amazon.CDK.AWS.ServiceDiscovery;
var app = new App();
var stack = new Stack(app, "aws-servicediscovery-integ");
var vpc = new Vpc(stack, "Vpc", new VpcProps { MaxAzs = 2 });
var namespace = new PrivateDnsNamespace(stack, "Namespace", new PrivateDnsNamespaceProps {
Name = "boobar.com",
Vpc = vpc
});
var service = namespace.CreateService("Service", new DnsServiceProps {
DnsRecordType = DnsRecordType.A_AAAA,
DnsTtl = Duration.Seconds(30),
LoadBalancer = true
});
var loadbalancer = new ApplicationLoadBalancer(stack, "LB", new ApplicationLoadBalancerProps { Vpc = vpc, InternetFacing = true });
service.RegisterLoadBalancer("Loadbalancer", loadbalancer);
app.Synth();
Public DNS Namespace Example
The following example creates an AWS Cloud Map namespace that supports both API calls and public DNS queries, creates a service in that namespace, and registers an IP instance:
using Amazon.CDK;
using Amazon.CDK.AWS.ServiceDiscovery;
var app = new App();
var stack = new Stack(app, "aws-servicediscovery-integ");
var namespace = new PublicDnsNamespace(stack, "Namespace", new PublicDnsNamespaceProps {
Name = "foobar.com"
});
var service = namespace.CreateService("Service", new DnsServiceProps {
Name = "foo",
DnsRecordType = DnsRecordType.A,
DnsTtl = Duration.Seconds(30),
HealthCheck = new HealthCheckConfig {
Type = HealthCheckType.HTTPS,
ResourcePath = "/healthcheck",
FailureThreshold = 2
}
});
service.RegisterIpInstance("IpInstance", new IpInstanceBaseProps {
Ipv4 = "54.239.25.192",
Port = 443
});
app.Synth();
For DNS namespaces, you can also register instances to services with CNAME records:
using Amazon.CDK;
using Amazon.CDK.AWS.ServiceDiscovery;
var app = new App();
var stack = new Stack(app, "aws-servicediscovery-integ");
var namespace = new PublicDnsNamespace(stack, "Namespace", new PublicDnsNamespaceProps {
Name = "foobar.com"
});
var service = namespace.CreateService("Service", new DnsServiceProps {
Name = "foo",
DnsRecordType = DnsRecordType.CNAME,
DnsTtl = Duration.Seconds(30)
});
service.RegisterCnameInstance("CnameInstance", new CnameInstanceBaseProps {
InstanceCname = "service.pizza"
});
app.Synth();
Classes
AliasTargetInstance | Instance that uses Route 53 Alias record type. |
AliasTargetInstanceProps | |
BaseInstanceProps | Used when the resource that's associated with the service instance is accessible using values other than an IP address or a domain name (CNAME), i.e. for non-ip-instances. |
BaseNamespaceProps | |
BaseServiceProps | Basic props needed to create a service in a given namespace. |
CfnHttpNamespace | A CloudFormation |
CfnHttpNamespaceProps | Properties for defining a |
CfnInstance | A CloudFormation |
CfnInstanceProps | Properties for defining a |
CfnPrivateDnsNamespace | A CloudFormation |
CfnPrivateDnsNamespace.PrivateDnsPropertiesMutableProperty | DNS properties for the private DNS namespace. |
CfnPrivateDnsNamespace.PropertiesProperty | Properties for the private DNS namespace. |
CfnPrivateDnsNamespace.SOAProperty | Start of Authority (SOA) properties for a public or private DNS namespace. |
CfnPrivateDnsNamespaceProps | Properties for defining a |
CfnPublicDnsNamespace | A CloudFormation |
CfnPublicDnsNamespace.PropertiesProperty | Properties for the public DNS namespace. |
CfnPublicDnsNamespace.PublicDnsPropertiesMutableProperty | DNS properties for the public DNS namespace. |
CfnPublicDnsNamespace.SOAProperty | Start of Authority (SOA) properties for a public or private DNS namespace. |
CfnPublicDnsNamespaceProps | Properties for defining a |
CfnService | A CloudFormation |
CfnService.DnsConfigProperty | A complex type that contains information about the Amazon Route 53 DNS records that you want AWS Cloud Map to create when you register an instance. |
CfnService.DnsRecordProperty | A complex type that contains information about the Route 53 DNS records that you want AWS Cloud Map to create when you register an instance. |
CfnService.HealthCheckConfigProperty | Public DNS and HTTP namespaces only. A complex type that contains settings for an optional health check. If you specify settings for a health check, AWS Cloud Map associates the health check with the records that you specify in |
CfnService.HealthCheckCustomConfigProperty | A complex type that contains information about an optional custom health check. |
CfnServiceProps | Properties for defining a |
CnameInstance | Instance that is accessible using a domain name (CNAME). |
CnameInstanceBaseProps | |
CnameInstanceProps | |
DnsRecordType | |
DnsServiceProps | Service props needed to create a service in a given namespace. |
HealthCheckConfig | Settings for an optional Amazon Route 53 health check. |
HealthCheckCustomConfig | Specifies information about an optional custom health check. |
HealthCheckType | |
HttpNamespace | Define an HTTP Namespace. |
HttpNamespaceAttributes | |
HttpNamespaceProps | |
InstanceBase | |
IpInstance | Instance that is accessible using an IP address. |
IpInstanceBaseProps | |
IpInstanceProps | |
NamespaceType | |
NonIpInstance | Instance accessible using values other than an IP address or a domain name (CNAME). |
NonIpInstanceBaseProps | |
NonIpInstanceProps | |
PrivateDnsNamespace | Define a Service Discovery HTTP Namespace. |
PrivateDnsNamespaceAttributes | |
PrivateDnsNamespaceProps | |
PublicDnsNamespace | Define a Public DNS Namespace. |
PublicDnsNamespaceAttributes | |
PublicDnsNamespaceProps | |
RoutingPolicy | |
Service | Define a CloudMap Service. |
ServiceAttributes | |
ServiceProps |
Interfaces
CfnPrivateDnsNamespace.IPrivateDnsPropertiesMutableProperty | DNS properties for the private DNS namespace. |
CfnPrivateDnsNamespace.IPropertiesProperty | Properties for the private DNS namespace. |
CfnPrivateDnsNamespace.ISOAProperty | Start of Authority (SOA) properties for a public or private DNS namespace. |
CfnPublicDnsNamespace.IPropertiesProperty | Properties for the public DNS namespace. |
CfnPublicDnsNamespace.IPublicDnsPropertiesMutableProperty | DNS properties for the public DNS namespace. |
CfnPublicDnsNamespace.ISOAProperty | Start of Authority (SOA) properties for a public or private DNS namespace. |
CfnService.IDnsConfigProperty | A complex type that contains information about the Amazon Route 53 DNS records that you want AWS Cloud Map to create when you register an instance. |
CfnService.IDnsRecordProperty | A complex type that contains information about the Route 53 DNS records that you want AWS Cloud Map to create when you register an instance. |
CfnService.IHealthCheckConfigProperty | Public DNS and HTTP namespaces only. A complex type that contains settings for an optional health check. If you specify settings for a health check, AWS Cloud Map associates the health check with the records that you specify in |
CfnService.IHealthCheckCustomConfigProperty | A complex type that contains information about an optional custom health check. |
IAliasTargetInstanceProps | |
IBaseInstanceProps | Used when the resource that's associated with the service instance is accessible using values other than an IP address or a domain name (CNAME), i.e. for non-ip-instances. |
IBaseNamespaceProps | |
IBaseServiceProps | Basic props needed to create a service in a given namespace. |
ICfnHttpNamespaceProps | Properties for defining a |
ICfnInstanceProps | Properties for defining a |
ICfnPrivateDnsNamespaceProps | Properties for defining a |
ICfnPublicDnsNamespaceProps | Properties for defining a |
ICfnServiceProps | Properties for defining a |
ICnameInstanceBaseProps | |
ICnameInstanceProps | |
IDnsServiceProps | Service props needed to create a service in a given namespace. |
IHealthCheckConfig | Settings for an optional Amazon Route 53 health check. |
IHealthCheckCustomConfig | Specifies information about an optional custom health check. |
IHttpNamespace | |
IHttpNamespaceAttributes | |
IHttpNamespaceProps | |
IInstance | |
IIpInstanceBaseProps | |
IIpInstanceProps | |
INamespace | |
INonIpInstanceBaseProps | |
INonIpInstanceProps | |
IPrivateDnsNamespace | |
IPrivateDnsNamespaceAttributes | |
IPrivateDnsNamespaceProps | |
IPublicDnsNamespace | |
IPublicDnsNamespaceAttributes | |
IPublicDnsNamespaceProps | |
IService | |
IServiceAttributes | |
IServiceProps |