AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.9.1 published on Tuesday, Jun 21, 2022 by Pulumi

getService

Use this data source to compose and decompose AWS service DNS names.

Example Usage

Get Service DNS Name

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var current = Output.Create(Aws.GetRegion.InvokeAsync());
        var test = current.Apply(current => Output.Create(Aws.GetService.InvokeAsync(new Aws.GetServiceArgs
        {
            Region = current.Name,
            ServiceId = "ec2",
        })));
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetRegion(ctx, nil, nil)
		if err != nil {
			return err
		}
		_, err = aws.GetService(ctx, &GetServiceArgs{
			Region:    pulumi.StringRef(current.Name),
			ServiceId: pulumi.StringRef("ec2"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

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

    public static void stack(Context ctx) {
        final var current = Output.of(AwsFunctions.getRegion());

        final var test = Output.of(AwsFunctions.getService(GetServiceArgs.builder()
            .region(current.apply(getRegionResult -> getRegionResult.name()))
            .serviceId("ec2")
            .build()));

    }
}
import pulumi
import pulumi_aws as aws

current = aws.get_region()
test = aws.get_service(region=current.name,
    service_id="ec2")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getRegion({});
const test = current.then(current => aws.getService({
    region: current.name,
    serviceId: "ec2",
}));
variables:
  current:
    Fn::Invoke:
      Function: aws:getRegion
      Arguments: {}
  test:
    Fn::Invoke:
      Function: aws:getService
      Arguments:
        region: ${current.name}
        serviceId: ec2

Use Service Reverse DNS Name to Get Components

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var s3 = Output.Create(Aws.GetService.InvokeAsync(new Aws.GetServiceArgs
        {
            ReverseDnsName = "cn.com.amazonaws.cn-north-1.s3",
        }));
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aws.GetService(ctx, &GetServiceArgs{
			ReverseDnsName: pulumi.StringRef("cn.com.amazonaws.cn-north-1.s3"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

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

    public static void stack(Context ctx) {
        final var s3 = Output.of(AwsFunctions.getService(GetServiceArgs.builder()
            .reverseDnsName("cn.com.amazonaws.cn-north-1.s3")
            .build()));

    }
}
import pulumi
import pulumi_aws as aws

s3 = aws.get_service(reverse_dns_name="cn.com.amazonaws.cn-north-1.s3")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const s3 = pulumi.output(aws.getService({
    reverseDnsName: "cn.com.amazonaws.cn-north-1.s3",
}));
variables:
  s3:
    Fn::Invoke:
      Function: aws:getService
      Arguments:
        reverseDnsName: cn.com.amazonaws.cn-north-1.s3

Determine Regional Support for a Service

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var s3 = Output.Create(Aws.GetService.InvokeAsync(new Aws.GetServiceArgs
        {
            ReverseDnsName = "com.amazonaws.us-gov-west-1.waf",
        }));
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aws.GetService(ctx, &GetServiceArgs{
			ReverseDnsName: pulumi.StringRef("com.amazonaws.us-gov-west-1.waf"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

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

    public static void stack(Context ctx) {
        final var s3 = Output.of(AwsFunctions.getService(GetServiceArgs.builder()
            .reverseDnsName("com.amazonaws.us-gov-west-1.waf")
            .build()));

    }
}
import pulumi
import pulumi_aws as aws

s3 = aws.get_service(reverse_dns_name="com.amazonaws.us-gov-west-1.waf")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const s3 = pulumi.output(aws.getService({
    reverseDnsName: "com.amazonaws.us-gov-west-1.waf",
}));
variables:
  s3:
    Fn::Invoke:
      Function: aws:getService
      Arguments:
        reverseDnsName: com.amazonaws.us-gov-west-1.waf

Using getService

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getService(args: GetServiceArgs, opts?: InvokeOptions): Promise<GetServiceResult>
function getServiceOutput(args: GetServiceOutputArgs, opts?: InvokeOptions): Output<GetServiceResult>
def get_service(dns_name: Optional[str] = None,
                region: Optional[str] = None,
                reverse_dns_name: Optional[str] = None,
                reverse_dns_prefix: Optional[str] = None,
                service_id: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetServiceResult
def get_service_output(dns_name: Optional[pulumi.Input[str]] = None,
                region: Optional[pulumi.Input[str]] = None,
                reverse_dns_name: Optional[pulumi.Input[str]] = None,
                reverse_dns_prefix: Optional[pulumi.Input[str]] = None,
                service_id: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetServiceResult]
func GetService(ctx *Context, args *GetServiceArgs, opts ...InvokeOption) (*GetServiceResult, error)
func GetServiceOutput(ctx *Context, args *GetServiceOutputArgs, opts ...InvokeOption) GetServiceResultOutput

> Note: This function is named GetService in the Go SDK.

public static class GetService 
{
    public static Task<GetServiceResult> InvokeAsync(GetServiceArgs args, InvokeOptions? opts = null)
    public static Output<GetServiceResult> Invoke(GetServiceInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetServiceResult> getService(GetServiceArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: aws:index/getService:getService
  Arguments:
    # Arguments dictionary

The following arguments are supported:

DnsName string

DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One of dns_name, reverse_dns_name, or service_id is required.

Region string

Region of the service (e.g., us-west-2, ap-northeast-1).

ReverseDnsName string

Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One of dns_name, reverse_dns_name, or service_id is required.

ReverseDnsPrefix string

Prefix of the service (e.g., com.amazonaws in AWS Commercial, cn.com.amazonaws in AWS China).

ServiceId string

Service (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is required.

DnsName string

DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One of dns_name, reverse_dns_name, or service_id is required.

Region string

Region of the service (e.g., us-west-2, ap-northeast-1).

ReverseDnsName string

Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One of dns_name, reverse_dns_name, or service_id is required.

ReverseDnsPrefix string

Prefix of the service (e.g., com.amazonaws in AWS Commercial, cn.com.amazonaws in AWS China).

ServiceId string

Service (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is required.

dnsName String

DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One of dns_name, reverse_dns_name, or service_id is required.

region String

Region of the service (e.g., us-west-2, ap-northeast-1).

reverseDnsName String

Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One of dns_name, reverse_dns_name, or service_id is required.

reverseDnsPrefix String

Prefix of the service (e.g., com.amazonaws in AWS Commercial, cn.com.amazonaws in AWS China).

serviceId String

Service (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is required.

dnsName string

DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One of dns_name, reverse_dns_name, or service_id is required.

region string

Region of the service (e.g., us-west-2, ap-northeast-1).

reverseDnsName string

Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One of dns_name, reverse_dns_name, or service_id is required.

reverseDnsPrefix string

Prefix of the service (e.g., com.amazonaws in AWS Commercial, cn.com.amazonaws in AWS China).

serviceId string

Service (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is required.

dns_name str

DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One of dns_name, reverse_dns_name, or service_id is required.

region str

Region of the service (e.g., us-west-2, ap-northeast-1).

reverse_dns_name str

Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One of dns_name, reverse_dns_name, or service_id is required.

reverse_dns_prefix str

Prefix of the service (e.g., com.amazonaws in AWS Commercial, cn.com.amazonaws in AWS China).

service_id str

Service (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is required.

dnsName String

DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One of dns_name, reverse_dns_name, or service_id is required.

region String

Region of the service (e.g., us-west-2, ap-northeast-1).

reverseDnsName String

Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One of dns_name, reverse_dns_name, or service_id is required.

reverseDnsPrefix String

Prefix of the service (e.g., com.amazonaws in AWS Commercial, cn.com.amazonaws in AWS China).

serviceId String

Service (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is required.

getService Result

The following output properties are available:

DnsName string
Id string

The provider-assigned unique ID for this managed resource.

Partition string
Region string
ReverseDnsName string
ReverseDnsPrefix string
ServiceId string
Supported bool

Whether the service is supported in the region's partition. New services may not be listed immediately as supported.

DnsName string
Id string

The provider-assigned unique ID for this managed resource.

Partition string
Region string
ReverseDnsName string
ReverseDnsPrefix string
ServiceId string
Supported bool

Whether the service is supported in the region's partition. New services may not be listed immediately as supported.

dnsName String
id String

The provider-assigned unique ID for this managed resource.

partition String
region String
reverseDnsName String
reverseDnsPrefix String
serviceId String
supported Boolean

Whether the service is supported in the region's partition. New services may not be listed immediately as supported.

dnsName string
id string

The provider-assigned unique ID for this managed resource.

partition string
region string
reverseDnsName string
reverseDnsPrefix string
serviceId string
supported boolean

Whether the service is supported in the region's partition. New services may not be listed immediately as supported.

dns_name str
id str

The provider-assigned unique ID for this managed resource.

partition str
region str
reverse_dns_name str
reverse_dns_prefix str
service_id str
supported bool

Whether the service is supported in the region's partition. New services may not be listed immediately as supported.

dnsName String
id String

The provider-assigned unique ID for this managed resource.

partition String
region String
reverseDnsName String
reverseDnsPrefix String
serviceId String
supported Boolean

Whether the service is supported in the region's partition. New services may not be listed immediately as supported.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.