AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi
aws.getService
Explore with Pulumi AI
Use this data source to compose and decompose AWS service DNS names.
Example Usage
Get Service DNS Name
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",
}));
import pulumi
import pulumi_aws as aws
current = aws.get_region()
test = aws.get_service(region=current.name,
    service_id="ec2")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetRegion(ctx, &aws.GetRegionArgs{}, nil)
		if err != nil {
			return err
		}
		_, err = aws.GetService(ctx, &aws.GetServiceArgs{
			Region:    pulumi.StringRef(current.Name),
			ServiceId: pulumi.StringRef("ec2"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var current = Aws.GetRegion.Invoke();
    var test = Aws.GetService.Invoke(new()
    {
        Region = current.Apply(getRegionResult => getRegionResult.Name),
        ServiceId = "ec2",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetRegionArgs;
import com.pulumi.aws.inputs.GetServiceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var current = AwsFunctions.getRegion();
        final var test = AwsFunctions.getService(GetServiceArgs.builder()
            .region(current.applyValue(getRegionResult -> getRegionResult.name()))
            .serviceId("ec2")
            .build());
    }
}
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
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const s3 = aws.getService({
    reverseDnsName: "cn.com.amazonaws.cn-north-1.s3",
});
import pulumi
import pulumi_aws as aws
s3 = aws.get_service(reverse_dns_name="cn.com.amazonaws.cn-north-1.s3")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aws.GetService(ctx, &aws.GetServiceArgs{
			ReverseDnsName: pulumi.StringRef("cn.com.amazonaws.cn-north-1.s3"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var s3 = Aws.GetService.Invoke(new()
    {
        ReverseDnsName = "cn.com.amazonaws.cn-north-1.s3",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetServiceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var s3 = AwsFunctions.getService(GetServiceArgs.builder()
            .reverseDnsName("cn.com.amazonaws.cn-north-1.s3")
            .build());
    }
}
variables:
  s3:
    fn::invoke:
      function: aws:getService
      arguments:
        reverseDnsName: cn.com.amazonaws.cn-north-1.s3
Determine Regional Support for a Service
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const s3 = aws.getService({
    reverseDnsName: "com.amazonaws.us-gov-west-1.waf",
});
import pulumi
import pulumi_aws as aws
s3 = aws.get_service(reverse_dns_name="com.amazonaws.us-gov-west-1.waf")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aws.GetService(ctx, &aws.GetServiceArgs{
			ReverseDnsName: pulumi.StringRef("com.amazonaws.us-gov-west-1.waf"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var s3 = Aws.GetService.Invoke(new()
    {
        ReverseDnsName = "com.amazonaws.us-gov-west-1.waf",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetServiceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var s3 = AwsFunctions.getService(GetServiceArgs.builder()
            .reverseDnsName("com.amazonaws.us-gov-west-1.waf")
            .build());
    }
}
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,
                id: 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,
                id: 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)
public static Output<GetServiceResult> getService(GetServiceArgs args, InvokeOptions options)
fn::invoke:
  function: aws:index/getService:getService
  arguments:
    # arguments dictionaryThe following arguments are supported:
- DnsName string
- DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One ofdns_name,reverse_dns_name, orservice_idis required.
- Id string
- Region string
- Region of the service (e.g., us-west-2,ap-northeast-1).
- ReverseDns stringName 
- Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One ofdns_name,reverse_dns_name, orservice_idis required.
- ReverseDns stringPrefix 
- Prefix of the service (e.g., com.amazonawsin AWS Commercial,cn.com.amazonawsin AWS China).
- ServiceId string
- Service endpoint ID (e.g., s3,rds,ec2). One ofdns_name,reverse_dns_name, orservice_idis required. A service's endpoint ID can be found in the AWS General Reference.
- DnsName string
- DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One ofdns_name,reverse_dns_name, orservice_idis required.
- Id string
- Region string
- Region of the service (e.g., us-west-2,ap-northeast-1).
- ReverseDns stringName 
- Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One ofdns_name,reverse_dns_name, orservice_idis required.
- ReverseDns stringPrefix 
- Prefix of the service (e.g., com.amazonawsin AWS Commercial,cn.com.amazonawsin AWS China).
- ServiceId string
- Service endpoint ID (e.g., s3,rds,ec2). One ofdns_name,reverse_dns_name, orservice_idis required. A service's endpoint ID can be found in the AWS General Reference.
- dnsName String
- DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One ofdns_name,reverse_dns_name, orservice_idis required.
- id String
- region String
- Region of the service (e.g., us-west-2,ap-northeast-1).
- reverseDns StringName 
- Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One ofdns_name,reverse_dns_name, orservice_idis required.
- reverseDns StringPrefix 
- Prefix of the service (e.g., com.amazonawsin AWS Commercial,cn.com.amazonawsin AWS China).
- serviceId String
- Service endpoint ID (e.g., s3,rds,ec2). One ofdns_name,reverse_dns_name, orservice_idis required. A service's endpoint ID can be found in the AWS General Reference.
- dnsName string
- DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One ofdns_name,reverse_dns_name, orservice_idis required.
- id string
- region string
- Region of the service (e.g., us-west-2,ap-northeast-1).
- reverseDns stringName 
- Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One ofdns_name,reverse_dns_name, orservice_idis required.
- reverseDns stringPrefix 
- Prefix of the service (e.g., com.amazonawsin AWS Commercial,cn.com.amazonawsin AWS China).
- serviceId string
- Service endpoint ID (e.g., s3,rds,ec2). One ofdns_name,reverse_dns_name, orservice_idis required. A service's endpoint ID can be found in the AWS General Reference.
- dns_name str
- DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One ofdns_name,reverse_dns_name, orservice_idis required.
- id str
- region str
- Region of the service (e.g., us-west-2,ap-northeast-1).
- reverse_dns_ strname 
- Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One ofdns_name,reverse_dns_name, orservice_idis required.
- reverse_dns_ strprefix 
- Prefix of the service (e.g., com.amazonawsin AWS Commercial,cn.com.amazonawsin AWS China).
- service_id str
- Service endpoint ID (e.g., s3,rds,ec2). One ofdns_name,reverse_dns_name, orservice_idis required. A service's endpoint ID can be found in the AWS General Reference.
- dnsName String
- DNS name of the service (e.g., rds.us-east-1.amazonaws.com). One ofdns_name,reverse_dns_name, orservice_idis required.
- id String
- region String
- Region of the service (e.g., us-west-2,ap-northeast-1).
- reverseDns StringName 
- Reverse DNS name of the service (e.g., com.amazonaws.us-west-2.s3). One ofdns_name,reverse_dns_name, orservice_idis required.
- reverseDns StringPrefix 
- Prefix of the service (e.g., com.amazonawsin AWS Commercial,cn.com.amazonawsin AWS China).
- serviceId String
- Service endpoint ID (e.g., s3,rds,ec2). One ofdns_name,reverse_dns_name, orservice_idis required. A service's endpoint ID can be found in the AWS General Reference.
getService Result
The following output properties are available:
- DnsName string
- Id string
- Partition string
- Region string
- ReverseDns stringName 
- ReverseDns stringPrefix 
- 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
- Partition string
- Region string
- ReverseDns stringName 
- ReverseDns stringPrefix 
- 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
- partition String
- region String
- reverseDns StringName 
- reverseDns StringPrefix 
- 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
- partition string
- region string
- reverseDns stringName 
- reverseDns stringPrefix 
- 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
- partition str
- region str
- reverse_dns_ strname 
- reverse_dns_ strprefix 
- 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
- partition String
- region String
- reverseDns StringName 
- reverseDns StringPrefix 
- 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
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.