1. Packages
  2. AWS Classic
  3. API Docs
  4. ecs
  5. getService

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

aws.ecs.getService

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

    The ECS Service data source allows access to details of a specific Service within a AWS ECS Cluster.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.ecs.getService({
        serviceName: "example",
        clusterArn: exampleAwsEcsCluster.arn,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ecs.get_service(service_name="example",
        cluster_arn=example_aws_ecs_cluster["arn"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ecs.LookupService(ctx, &ecs.LookupServiceArgs{
    			ServiceName: "example",
    			ClusterArn:  exampleAwsEcsCluster.Arn,
    		}, 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 example = Aws.Ecs.GetService.Invoke(new()
        {
            ServiceName = "example",
            ClusterArn = exampleAwsEcsCluster.Arn,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ecs.EcsFunctions;
    import com.pulumi.aws.ecs.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 example = EcsFunctions.getService(GetServiceArgs.builder()
                .serviceName("example")
                .clusterArn(exampleAwsEcsCluster.arn())
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:ecs:getService
          Arguments:
            serviceName: example
            clusterArn: ${exampleAwsEcsCluster.arn}
    

    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(cluster_arn: Optional[str] = None,
                    service_name: Optional[str] = None,
                    tags: Optional[Mapping[str, str]] = None,
                    opts: Optional[InvokeOptions] = None) -> GetServiceResult
    def get_service_output(cluster_arn: Optional[pulumi.Input[str]] = None,
                    service_name: Optional[pulumi.Input[str]] = None,
                    tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetServiceResult]
    func LookupService(ctx *Context, args *LookupServiceArgs, opts ...InvokeOption) (*LookupServiceResult, error)
    func LookupServiceOutput(ctx *Context, args *LookupServiceOutputArgs, opts ...InvokeOption) LookupServiceResultOutput

    > Note: This function is named LookupService 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:ecs/getService:getService
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ClusterArn string
    ARN of the ECS Cluster
    ServiceName string
    Name of the ECS Service
    Tags Dictionary<string, string>
    Resource tags.
    ClusterArn string
    ARN of the ECS Cluster
    ServiceName string
    Name of the ECS Service
    Tags map[string]string
    Resource tags.
    clusterArn String
    ARN of the ECS Cluster
    serviceName String
    Name of the ECS Service
    tags Map<String,String>
    Resource tags.
    clusterArn string
    ARN of the ECS Cluster
    serviceName string
    Name of the ECS Service
    tags {[key: string]: string}
    Resource tags.
    cluster_arn str
    ARN of the ECS Cluster
    service_name str
    Name of the ECS Service
    tags Mapping[str, str]
    Resource tags.
    clusterArn String
    ARN of the ECS Cluster
    serviceName String
    Name of the ECS Service
    tags Map<String>
    Resource tags.

    getService Result

    The following output properties are available:

    Arn string
    ARN of the ECS Service
    ClusterArn string
    DesiredCount int
    Number of tasks for the ECS Service
    Id string
    The provider-assigned unique ID for this managed resource.
    LaunchType string
    Launch type for the ECS Service
    SchedulingStrategy string
    Scheduling strategy for the ECS Service
    ServiceName string
    Tags Dictionary<string, string>
    Resource tags.
    TaskDefinition string
    Family for the latest ACTIVE revision or full ARN of the task definition.
    Arn string
    ARN of the ECS Service
    ClusterArn string
    DesiredCount int
    Number of tasks for the ECS Service
    Id string
    The provider-assigned unique ID for this managed resource.
    LaunchType string
    Launch type for the ECS Service
    SchedulingStrategy string
    Scheduling strategy for the ECS Service
    ServiceName string
    Tags map[string]string
    Resource tags.
    TaskDefinition string
    Family for the latest ACTIVE revision or full ARN of the task definition.
    arn String
    ARN of the ECS Service
    clusterArn String
    desiredCount Integer
    Number of tasks for the ECS Service
    id String
    The provider-assigned unique ID for this managed resource.
    launchType String
    Launch type for the ECS Service
    schedulingStrategy String
    Scheduling strategy for the ECS Service
    serviceName String
    tags Map<String,String>
    Resource tags.
    taskDefinition String
    Family for the latest ACTIVE revision or full ARN of the task definition.
    arn string
    ARN of the ECS Service
    clusterArn string
    desiredCount number
    Number of tasks for the ECS Service
    id string
    The provider-assigned unique ID for this managed resource.
    launchType string
    Launch type for the ECS Service
    schedulingStrategy string
    Scheduling strategy for the ECS Service
    serviceName string
    tags {[key: string]: string}
    Resource tags.
    taskDefinition string
    Family for the latest ACTIVE revision or full ARN of the task definition.
    arn str
    ARN of the ECS Service
    cluster_arn str
    desired_count int
    Number of tasks for the ECS Service
    id str
    The provider-assigned unique ID for this managed resource.
    launch_type str
    Launch type for the ECS Service
    scheduling_strategy str
    Scheduling strategy for the ECS Service
    service_name str
    tags Mapping[str, str]
    Resource tags.
    task_definition str
    Family for the latest ACTIVE revision or full ARN of the task definition.
    arn String
    ARN of the ECS Service
    clusterArn String
    desiredCount Number
    Number of tasks for the ECS Service
    id String
    The provider-assigned unique ID for this managed resource.
    launchType String
    Launch type for the ECS Service
    schedulingStrategy String
    Scheduling strategy for the ECS Service
    serviceName String
    tags Map<String>
    Resource tags.
    taskDefinition String
    Family for the latest ACTIVE revision or full ARN of the task definition.

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi