1. Packages
  2. AWS
  3. API Docs
  4. getService
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.getService

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    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)
    // 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.
    Id string
    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 endpoint ID (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is 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 of dns_name, reverse_dns_name, or service_id is required.
    Id string
    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 endpoint ID (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is 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 of dns_name, reverse_dns_name, or service_id is required.
    id String
    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 endpoint ID (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is 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 of dns_name, reverse_dns_name, or service_id is required.
    id string
    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 endpoint ID (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is 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 of dns_name, reverse_dns_name, or service_id is required.
    id str
    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 endpoint ID (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is 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 of dns_name, reverse_dns_name, or service_id is required.
    id String
    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 endpoint ID (e.g., s3, rds, ec2). One of dns_name, reverse_dns_name, or service_id is 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
    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
    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
    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
    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
    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
    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
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi