AWS v6.60.0 published on Tuesday, Nov 19, 2024 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)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:index/getService:getService
arguments:
# arguments dictionary
The following arguments are supported:
- Dns
Name string - DNS name of the service (e.g.,
rds.us-east-1.amazonaws.com
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - Id string
- Region string
- Region of the service (e.g.,
us-west-2
,ap-northeast-1
). - Reverse
Dns stringName - Reverse DNS name of the service (e.g.,
com.amazonaws.us-west-2.s3
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - Reverse
Dns stringPrefix - Prefix of the service (e.g.,
com.amazonaws
in AWS Commercial,cn.com.amazonaws
in AWS China). - Service
Id string - Service endpoint ID (e.g.,
s3
,rds
,ec2
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. A service's endpoint ID can be found in the AWS General Reference.
- Dns
Name string - DNS name of the service (e.g.,
rds.us-east-1.amazonaws.com
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - Id string
- Region string
- Region of the service (e.g.,
us-west-2
,ap-northeast-1
). - Reverse
Dns stringName - Reverse DNS name of the service (e.g.,
com.amazonaws.us-west-2.s3
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - Reverse
Dns stringPrefix - Prefix of the service (e.g.,
com.amazonaws
in AWS Commercial,cn.com.amazonaws
in AWS China). - Service
Id string - Service endpoint ID (e.g.,
s3
,rds
,ec2
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. A service's endpoint ID can be found in the AWS General Reference.
- dns
Name String - DNS name of the service (e.g.,
rds.us-east-1.amazonaws.com
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - id String
- region String
- Region of the service (e.g.,
us-west-2
,ap-northeast-1
). - reverse
Dns StringName - Reverse DNS name of the service (e.g.,
com.amazonaws.us-west-2.s3
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - reverse
Dns StringPrefix - Prefix of the service (e.g.,
com.amazonaws
in AWS Commercial,cn.com.amazonaws
in AWS China). - service
Id String - Service endpoint ID (e.g.,
s3
,rds
,ec2
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. A service's endpoint ID can be found in the AWS General Reference.
- dns
Name string - DNS name of the service (e.g.,
rds.us-east-1.amazonaws.com
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - id string
- region string
- Region of the service (e.g.,
us-west-2
,ap-northeast-1
). - reverse
Dns stringName - Reverse DNS name of the service (e.g.,
com.amazonaws.us-west-2.s3
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - reverse
Dns stringPrefix - Prefix of the service (e.g.,
com.amazonaws
in AWS Commercial,cn.com.amazonaws
in AWS China). - service
Id string - Service endpoint ID (e.g.,
s3
,rds
,ec2
). One ofdns_name
,reverse_dns_name
, orservice_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 ofdns_name
,reverse_dns_name
, orservice_id
is 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_id
is required. - reverse_
dns_ strprefix - 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 ofdns_name
,reverse_dns_name
, orservice_id
is required. A service's endpoint ID can be found in the AWS General Reference.
- dns
Name String - DNS name of the service (e.g.,
rds.us-east-1.amazonaws.com
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - id String
- region String
- Region of the service (e.g.,
us-west-2
,ap-northeast-1
). - reverse
Dns StringName - Reverse DNS name of the service (e.g.,
com.amazonaws.us-west-2.s3
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. - reverse
Dns StringPrefix - Prefix of the service (e.g.,
com.amazonaws
in AWS Commercial,cn.com.amazonaws
in AWS China). - service
Id String - Service endpoint ID (e.g.,
s3
,rds
,ec2
). One ofdns_name
,reverse_dns_name
, orservice_id
is required. A service's endpoint ID can be found in the AWS General Reference.
getService Result
The following output properties are available:
- Dns
Name string - Id string
- Partition string
- Region string
- Reverse
Dns stringName - Reverse
Dns stringPrefix - Service
Id string - Supported bool
- Whether the service is supported in the region's partition. New services may not be listed immediately as supported.
- Dns
Name string - Id string
- Partition string
- Region string
- Reverse
Dns stringName - Reverse
Dns stringPrefix - Service
Id string - Supported bool
- Whether the service is supported in the region's partition. New services may not be listed immediately as supported.
- dns
Name String - id String
- partition String
- region String
- reverse
Dns StringName - reverse
Dns StringPrefix - service
Id String - supported Boolean
- Whether the service is supported in the region's partition. New services may not be listed immediately as supported.
- dns
Name string - id string
- partition string
- region string
- reverse
Dns stringName - reverse
Dns stringPrefix - service
Id 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.
- dns
Name String - id String
- partition String
- region String
- reverse
Dns StringName - reverse
Dns StringPrefix - service
Id 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.