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.

DnsConfig ServiceDnsConfigArgs

A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.

HealthCheckConfig ServiceHealthCheckConfigArgs

A complex type that contains settings for an optional health check. Only for Public DNS namespaces.

HealthCheckCustomConfig ServiceHealthCheckCustomConfigArgs

A complex type that contains settings for ECS managed health checks.

Name string

The name of the service.

NamespaceId string

The ID of the namespace to use for DNS configuration.

Tags Dictionary<string, string>

A map of tags to assign to the service.

Description string

The description of the service.

DnsConfig ServiceDnsConfig

A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.

HealthCheckConfig ServiceHealthCheckConfig

A complex type that contains settings for an optional health check. Only for Public DNS namespaces.

HealthCheckCustomConfig ServiceHealthCheckCustomConfig

A complex type that contains settings for ECS managed health checks.

Name string

The name of the service.

NamespaceId string

The ID of the namespace to use for DNS configuration.

Tags map[string]string

A map of tags to assign to the service.

description string

The description of the service.

dnsConfig ServiceDnsConfig

A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.

healthCheckConfig ServiceHealthCheckConfig

A complex type that contains settings for an optional health check. Only for Public DNS namespaces.

healthCheckCustomConfig ServiceHealthCheckCustomConfig

A complex type that contains settings for ECS managed health checks.

name string

The name of the service.

namespaceId string

The ID of the namespace to use for DNS configuration.

tags {[key: string]: string}

A map of tags to assign to the service.

description str

The description of the service.

dns_config Dict[ServiceDnsConfig]

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_config Dict[ServiceHealthCheckConfig]

A complex type that contains settings for an optional health check. Only for Public DNS namespaces.

health_check_custom_config Dict[ServiceHealthCheckCustomConfig]

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.

tags 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:

Arn string

The ARN of the service.

Id string
The provider-assigned unique ID for this managed resource.
Arn string

The ARN of the service.

Id string
The provider-assigned unique ID for this managed resource.
arn string

The ARN of the service.

id string
The provider-assigned unique ID for this managed resource.
arn str

The ARN of the service.

id str
The provider-assigned unique ID for this managed resource.

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): Service
static 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.

DnsConfig ServiceDnsConfigArgs

A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.

HealthCheckConfig ServiceHealthCheckConfigArgs

A complex type that contains settings for an optional health check. Only for Public DNS namespaces.

HealthCheckCustomConfig ServiceHealthCheckCustomConfigArgs

A complex type that contains settings for ECS managed health checks.

Name string

The name of the service.

NamespaceId string

The ID of the namespace to use for DNS configuration.

Tags 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.

DnsConfig ServiceDnsConfig

A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.

HealthCheckConfig ServiceHealthCheckConfig

A complex type that contains settings for an optional health check. Only for Public DNS namespaces.

HealthCheckCustomConfig ServiceHealthCheckCustomConfig

A complex type that contains settings for ECS managed health checks.

Name string

The name of the service.

NamespaceId string

The ID of the namespace to use for DNS configuration.

Tags 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.

dnsConfig ServiceDnsConfig

A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance.

healthCheckConfig ServiceHealthCheckConfig

A complex type that contains settings for an optional health check. Only for Public DNS namespaces.

healthCheckCustomConfig ServiceHealthCheckCustomConfig

A complex type that contains settings for ECS managed health checks.

name string

The name of the service.

namespaceId string

The ID of the namespace to use for DNS configuration.

tags {[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[ServiceDnsConfig]

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_config Dict[ServiceHealthCheckConfig]

A complex type that contains settings for an optional health check. Only for Public DNS namespaces.

health_check_custom_config Dict[ServiceHealthCheckCustomConfig]

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.

tags Dict[str, str]

A map of tags to assign to the service.

Supporting Types

ServiceDnsConfig

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

DnsRecords List<ServiceDnsConfigDnsRecordArgs>

An array that contains one DnsRecord object for each resource record set.

NamespaceId string

The ID of the namespace to use for DNS configuration.

RoutingPolicy 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

DnsRecords []ServiceDnsConfigDnsRecord

An array that contains one DnsRecord object for each resource record set.

NamespaceId string

The ID of the namespace to use for DNS configuration.

RoutingPolicy 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

dnsRecords ServiceDnsConfigDnsRecord[]

An array that contains one DnsRecord object for each resource record set.

namespaceId string

The ID of the namespace to use for DNS configuration.

routingPolicy 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

dnsRecords List[ServiceDnsConfigDnsRecord]

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.

routingPolicy 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

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Ttl int

The amount of time, in seconds, that you want DNS resolvers to cache the settings for this resource record set.

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

Ttl int

The amount of time, in seconds, that you want DNS resolvers to cache the settings for this resource record set.

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

ttl number

The amount of time, in seconds, that you want DNS resolvers to cache the settings for this resource record set.

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

ttl float

The amount of time, in seconds, that you want DNS resolvers to cache the settings for this resource record set.

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

ServiceHealthCheckConfig

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

FailureThreshold 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.

ResourcePath 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

FailureThreshold 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.

ResourcePath 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

failureThreshold 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.

resourcePath 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

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

FailureThreshold 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.

FailureThreshold 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.

failureThreshold 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 aws Terraform Provider.