Service
Provides a Service Discovery Service resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleVpc = new Aws.Ec2.Vpc("exampleVpc", new Aws.Ec2.VpcArgs
{
CidrBlock = "10.0.0.0/16",
EnableDnsHostnames = true,
EnableDnsSupport = true,
});
var examplePrivateDnsNamespace = new Aws.ServiceDiscovery.PrivateDnsNamespace("examplePrivateDnsNamespace", new Aws.ServiceDiscovery.PrivateDnsNamespaceArgs
{
Description = "example",
Vpc = exampleVpc.Id,
});
var exampleService = new Aws.ServiceDiscovery.Service("exampleService", new Aws.ServiceDiscovery.ServiceArgs
{
DnsConfig = new Aws.ServiceDiscovery.Inputs.ServiceDnsConfigArgs
{
DnsRecords =
{
new Aws.ServiceDiscovery.Inputs.ServiceDnsConfigDnsRecordArgs
{
Ttl = 10,
Type = "A",
},
},
NamespaceId = examplePrivateDnsNamespace.Id,
RoutingPolicy = "MULTIVALUE",
},
HealthCheckCustomConfig = new Aws.ServiceDiscovery.Inputs.ServiceHealthCheckCustomConfigArgs
{
FailureThreshold = 1,
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/servicediscovery"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleVpc, err := ec2.NewVpc(ctx, "exampleVpc", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
EnableDnsHostnames: pulumi.Bool(true),
EnableDnsSupport: pulumi.Bool(true),
})
if err != nil {
return err
}
examplePrivateDnsNamespace, err := servicediscovery.NewPrivateDnsNamespace(ctx, "examplePrivateDnsNamespace", &servicediscovery.PrivateDnsNamespaceArgs{
Description: pulumi.String("example"),
Vpc: exampleVpc.ID(),
})
if err != nil {
return err
}
_, err = servicediscovery.NewService(ctx, "exampleService", &servicediscovery.ServiceArgs{
DnsConfig: &servicediscovery.ServiceDnsConfigArgs{
DnsRecords: servicediscovery.ServiceDnsConfigDnsRecordArray{
&servicediscovery.ServiceDnsConfigDnsRecordArgs{
Ttl: pulumi.Int(10),
Type: pulumi.String("A"),
},
},
NamespaceId: examplePrivateDnsNamespace.ID(),
RoutingPolicy: pulumi.String("MULTIVALUE"),
},
HealthCheckCustomConfig: &servicediscovery.ServiceHealthCheckCustomConfigArgs{
FailureThreshold: pulumi.Int(1),
},
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example_vpc = aws.ec2.Vpc("exampleVpc",
cidr_block="10.0.0.0/16",
enable_dns_hostnames=True,
enable_dns_support=True)
example_private_dns_namespace = aws.servicediscovery.PrivateDnsNamespace("examplePrivateDnsNamespace",
description="example",
vpc=example_vpc.id)
example_service = aws.servicediscovery.Service("exampleService",
dns_config={
"dnsRecords": [{
"ttl": 10,
"type": "A",
}],
"namespace_id": example_private_dns_namespace.id,
"routingPolicy": "MULTIVALUE",
},
health_check_custom_config={
"failure_threshold": 1,
})import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleVpc = new aws.ec2.Vpc("example", {
cidrBlock: "10.0.0.0/16",
enableDnsHostnames: true,
enableDnsSupport: true,
});
const examplePrivateDnsNamespace = new aws.servicediscovery.PrivateDnsNamespace("example", {
description: "example",
vpc: exampleVpc.id,
});
const exampleService = new aws.servicediscovery.Service("example", {
dnsConfig: {
dnsRecords: [{
ttl: 10,
type: "A",
}],
namespaceId: examplePrivateDnsNamespace.id,
routingPolicy: "MULTIVALUE",
},
healthCheckCustomConfig: {
failureThreshold: 1,
},
});Create a Service Resource
new Service(name: string, args?: ServiceArgs, opts?: CustomResourceOptions);def Service(resource_name, opts=None, description=None, dns_config=None, health_check_config=None, health_check_custom_config=None, name=None, namespace_id=None, tags=None, __props__=None);func NewService(ctx *Context, name string, args *ServiceArgs, opts ...ResourceOption) (*Service, error)public Service(string name, ServiceArgs? args = null, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ServiceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ServiceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServiceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Service Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Service resource accepts the following input properties:
- Description string
The description of the service.
- Dns
Config ServiceDns Config Args A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.
- Health
Check ServiceConfig Health Check Config Args A complex type that contains settings for an optional health check. Only for Public DNS namespaces.
- Health
Check ServiceCustom Config Health Check Custom Config Args A complex type that contains settings for ECS managed health checks.
- Name string
The name of the service.
- Namespace
Id string The ID of the namespace to use for DNS configuration.
- Dictionary<string, string>
A map of tags to assign to the service.
- Description string
The description of the service.
- Dns
Config ServiceDns Config A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.
- Health
Check ServiceConfig Health Check Config A complex type that contains settings for an optional health check. Only for Public DNS namespaces.
- Health
Check ServiceCustom Config Health Check Custom Config A complex type that contains settings for ECS managed health checks.
- Name string
The name of the service.
- Namespace
Id string The ID of the namespace to use for DNS configuration.
- map[string]string
A map of tags to assign to the service.
- description string
The description of the service.
- dns
Config ServiceDns Config A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.
- health
Check ServiceConfig Health Check Config A complex type that contains settings for an optional health check. Only for Public DNS namespaces.
- health
Check ServiceCustom Config Health Check Custom Config A complex type that contains settings for ECS managed health checks.
- name string
The name of the service.
- namespace
Id string The ID of the namespace to use for DNS configuration.
- {[key: string]: string}
A map of tags to assign to the service.
- description str
The description of the service.
- dns_
config Dict[ServiceDns Config] A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.
- health_
check_ Dict[Serviceconfig Health Check Config] A complex type that contains settings for an optional health check. Only for Public DNS namespaces.
- health_
check_ Dict[Servicecustom_ config Health Check Custom Config] A complex type that contains settings for ECS managed health checks.
- name str
The name of the service.
- namespace_
id str The ID of the namespace to use for DNS configuration.
- Dict[str, str]
A map of tags to assign to the service.
Outputs
All input properties are implicitly available as output properties. Additionally, the Service resource produces the following output properties:
Look up an Existing Service Resource
Get an existing Service 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?: ServiceState, opts?: CustomResourceOptions): Servicestatic get(resource_name, id, opts=None, arn=None, description=None, dns_config=None, health_check_config=None, health_check_custom_config=None, name=None, namespace_id=None, tags=None, __props__=None);func GetService(ctx *Context, name string, id IDInput, state *ServiceState, opts ...ResourceOption) (*Service, error)public static Service Get(string name, Input<string> id, ServiceState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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:
- Arn string
The ARN of the service.
- Description string
The description of the service.
- Dns
Config ServiceDns Config Args A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.
- Health
Check ServiceConfig Health Check Config Args A complex type that contains settings for an optional health check. Only for Public DNS namespaces.
- Health
Check ServiceCustom Config Health Check Custom Config Args A complex type that contains settings for ECS managed health checks.
- Name string
The name of the service.
- Namespace
Id string The ID of the namespace to use for DNS configuration.
- Dictionary<string, string>
A map of tags to assign to the service.
- Arn string
The ARN of the service.
- Description string
The description of the service.
- Dns
Config ServiceDns Config A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.
- Health
Check ServiceConfig Health Check Config A complex type that contains settings for an optional health check. Only for Public DNS namespaces.
- Health
Check ServiceCustom Config Health Check Custom Config A complex type that contains settings for ECS managed health checks.
- Name string
The name of the service.
- Namespace
Id string The ID of the namespace to use for DNS configuration.
- map[string]string
A map of tags to assign to the service.
- arn string
The ARN of the service.
- description string
The description of the service.
- dns
Config ServiceDns Config A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.
- health
Check ServiceConfig Health Check Config A complex type that contains settings for an optional health check. Only for Public DNS namespaces.
- health
Check ServiceCustom Config Health Check Custom Config A complex type that contains settings for ECS managed health checks.
- name string
The name of the service.
- namespace
Id string The ID of the namespace to use for DNS configuration.
- {[key: string]: string}
A map of tags to assign to the service.
- arn str
The ARN of the service.
- description str
The description of the service.
- dns_
config Dict[ServiceDns Config] A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.
- health_
check_ Dict[Serviceconfig Health Check Config] A complex type that contains settings for an optional health check. Only for Public DNS namespaces.
- health_
check_ Dict[Servicecustom_ config Health Check Custom Config] A complex type that contains settings for ECS managed health checks.
- name str
The name of the service.
- namespace_
id str The ID of the namespace to use for DNS configuration.
- Dict[str, str]
A map of tags to assign to the service.
Supporting Types
ServiceDnsConfig
- Dns
Records List<ServiceDns Config Dns Record Args> An array that contains one DnsRecord object for each resource record set.
- Namespace
Id string The ID of the namespace to use for DNS configuration.
- Routing
Policy string The routing policy that you want to apply to all records that Route 53 creates when you register an instance and specify the service. Valid Values: MULTIVALUE, WEIGHTED
- Dns
Records []ServiceDns Config Dns Record An array that contains one DnsRecord object for each resource record set.
- Namespace
Id string The ID of the namespace to use for DNS configuration.
- Routing
Policy string The routing policy that you want to apply to all records that Route 53 creates when you register an instance and specify the service. Valid Values: MULTIVALUE, WEIGHTED
- dns
Records ServiceDns Config Dns Record[] An array that contains one DnsRecord object for each resource record set.
- namespace
Id string The ID of the namespace to use for DNS configuration.
- routing
Policy string The routing policy that you want to apply to all records that Route 53 creates when you register an instance and specify the service. Valid Values: MULTIVALUE, WEIGHTED
- dns
Records List[ServiceDns Config Dns Record] An array that contains one DnsRecord object for each resource record set.
- namespace_
id str The ID of the namespace to use for DNS configuration.
- routing
Policy str The routing policy that you want to apply to all records that Route 53 creates when you register an instance and specify the service. Valid Values: MULTIVALUE, WEIGHTED
ServiceDnsConfigDnsRecord
ServiceHealthCheckConfig
- Failure
Threshold int The number of 30-second intervals that you want service discovery to wait before it changes the health status of a service instance. Maximum value of 10.
- Resource
Path string The path that you want Route 53 to request when performing health checks. Route 53 automatically adds the DNS name for the service. If you don’t specify a value, the default value is /.
- Type string
The type of health check that you want to create, which indicates how Route 53 determines whether an endpoint is healthy. Valid Values: HTTP, HTTPS, TCP
- Failure
Threshold int The number of 30-second intervals that you want service discovery to wait before it changes the health status of a service instance. Maximum value of 10.
- Resource
Path string The path that you want Route 53 to request when performing health checks. Route 53 automatically adds the DNS name for the service. If you don’t specify a value, the default value is /.
- Type string
The type of health check that you want to create, which indicates how Route 53 determines whether an endpoint is healthy. Valid Values: HTTP, HTTPS, TCP
- failure
Threshold number The number of 30-second intervals that you want service discovery to wait before it changes the health status of a service instance. Maximum value of 10.
- resource
Path string The path that you want Route 53 to request when performing health checks. Route 53 automatically adds the DNS name for the service. If you don’t specify a value, the default value is /.
- type string
The type of health check that you want to create, which indicates how Route 53 determines whether an endpoint is healthy. Valid Values: HTTP, HTTPS, TCP
- failure_
threshold float The number of 30-second intervals that you want service discovery to wait before it changes the health status of a service instance. Maximum value of 10.
- resource_
path str The path that you want Route 53 to request when performing health checks. Route 53 automatically adds the DNS name for the service. If you don’t specify a value, the default value is /.
- type str
The type of health check that you want to create, which indicates how Route 53 determines whether an endpoint is healthy. Valid Values: HTTP, HTTPS, TCP
ServiceHealthCheckCustomConfig
- Failure
Threshold int The number of 30-second intervals that you want service discovery to wait before it changes the health status of a service instance. Maximum value of 10.
- Failure
Threshold int The number of 30-second intervals that you want service discovery to wait before it changes the health status of a service instance. Maximum value of 10.
- failure
Threshold number The number of 30-second intervals that you want service discovery to wait before it changes the health status of a service instance. Maximum value of 10.
- failure_
threshold float The number of 30-second intervals that you want service discovery to wait before it changes the health status of a service instance. Maximum value of 10.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.