1. Packages
  2. AWS
  3. API Docs
  4. ecs
  5. getService
AWS v7.4.0 published on Wednesday, Aug 13, 2025 by Pulumi

aws.ecs.getService

Explore with Pulumi AI

aws logo
AWS v7.4.0 published on Wednesday, Aug 13, 2025 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/v7/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,
                    region: 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,
                    region: 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)
    public static Output<GetServiceResult> getService(GetServiceArgs args, InvokeOptions options)
    
    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
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    Tags Dictionary<string, string>
    Resource tags.
    ClusterArn string
    ARN of the ECS Cluster
    ServiceName string
    Name of the ECS Service
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    Tags map[string]string
    Resource tags.
    clusterArn String
    ARN of the ECS Cluster
    serviceName String
    Name of the ECS Service
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Map<String,String>
    Resource tags.
    clusterArn string
    ARN of the ECS Cluster
    serviceName string
    Name of the ECS Service
    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags {[key: string]: string}
    Resource tags.
    cluster_arn str
    ARN of the ECS Cluster
    service_name str
    Name of the ECS Service
    region str
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Mapping[str, str]
    Resource tags.
    clusterArn String
    ARN of the ECS Cluster
    serviceName String
    Name of the ECS Service
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Map<String>
    Resource tags.

    getService Result

    The following output properties are available:

    Arn string
    ARN of the ECS Service
    AvailabilityZoneRebalancing string
    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
    LoadBalancers List<GetServiceLoadBalancer>
    Load balancers for the ECS Service. See load_balancer Block for details.
    Region string
    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
    AvailabilityZoneRebalancing string
    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
    LoadBalancers []GetServiceLoadBalancer
    Load balancers for the ECS Service. See load_balancer Block for details.
    Region string
    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
    availabilityZoneRebalancing String
    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
    loadBalancers List<GetServiceLoadBalancer>
    Load balancers for the ECS Service. See load_balancer Block for details.
    region String
    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
    availabilityZoneRebalancing string
    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
    loadBalancers GetServiceLoadBalancer[]
    Load balancers for the ECS Service. See load_balancer Block for details.
    region string
    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
    availability_zone_rebalancing str
    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
    load_balancers Sequence[GetServiceLoadBalancer]
    Load balancers for the ECS Service. See load_balancer Block for details.
    region str
    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
    availabilityZoneRebalancing String
    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
    loadBalancers List<Property Map>
    Load balancers for the ECS Service. See load_balancer Block for details.
    region String
    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.

    Supporting Types

    GetServiceLoadBalancer

    AdvancedConfigurations List<GetServiceLoadBalancerAdvancedConfiguration>
    Settings for Blue/Green deployment. See advanced_configuration Block for details.
    ContainerName string
    Name of the container to associate with the load balancer.
    ContainerPort int
    Port on the container to associate with the load balancer.
    ElbName string
    Name of the load balancer.
    TargetGroupArn string
    ARN of the target group to associate with the load balancer.
    AdvancedConfigurations []GetServiceLoadBalancerAdvancedConfiguration
    Settings for Blue/Green deployment. See advanced_configuration Block for details.
    ContainerName string
    Name of the container to associate with the load balancer.
    ContainerPort int
    Port on the container to associate with the load balancer.
    ElbName string
    Name of the load balancer.
    TargetGroupArn string
    ARN of the target group to associate with the load balancer.
    advancedConfigurations List<GetServiceLoadBalancerAdvancedConfiguration>
    Settings for Blue/Green deployment. See advanced_configuration Block for details.
    containerName String
    Name of the container to associate with the load balancer.
    containerPort Integer
    Port on the container to associate with the load balancer.
    elbName String
    Name of the load balancer.
    targetGroupArn String
    ARN of the target group to associate with the load balancer.
    advancedConfigurations GetServiceLoadBalancerAdvancedConfiguration[]
    Settings for Blue/Green deployment. See advanced_configuration Block for details.
    containerName string
    Name of the container to associate with the load balancer.
    containerPort number
    Port on the container to associate with the load balancer.
    elbName string
    Name of the load balancer.
    targetGroupArn string
    ARN of the target group to associate with the load balancer.
    advanced_configurations Sequence[GetServiceLoadBalancerAdvancedConfiguration]
    Settings for Blue/Green deployment. See advanced_configuration Block for details.
    container_name str
    Name of the container to associate with the load balancer.
    container_port int
    Port on the container to associate with the load balancer.
    elb_name str
    Name of the load balancer.
    target_group_arn str
    ARN of the target group to associate with the load balancer.
    advancedConfigurations List<Property Map>
    Settings for Blue/Green deployment. See advanced_configuration Block for details.
    containerName String
    Name of the container to associate with the load balancer.
    containerPort Number
    Port on the container to associate with the load balancer.
    elbName String
    Name of the load balancer.
    targetGroupArn String
    ARN of the target group to associate with the load balancer.

    GetServiceLoadBalancerAdvancedConfiguration

    AlternateTargetGroupArn string
    ARN of the alternate target group to use for Blue/Green deployments.
    ProductionListenerRule string
    ARN of the listener rule that routes production traffic.
    RoleArn string
    ARN of the IAM role that allows ECS to manage the target groups.
    TestListenerRule string
    ARN of the listener rule that routes test traffic.
    AlternateTargetGroupArn string
    ARN of the alternate target group to use for Blue/Green deployments.
    ProductionListenerRule string
    ARN of the listener rule that routes production traffic.
    RoleArn string
    ARN of the IAM role that allows ECS to manage the target groups.
    TestListenerRule string
    ARN of the listener rule that routes test traffic.
    alternateTargetGroupArn String
    ARN of the alternate target group to use for Blue/Green deployments.
    productionListenerRule String
    ARN of the listener rule that routes production traffic.
    roleArn String
    ARN of the IAM role that allows ECS to manage the target groups.
    testListenerRule String
    ARN of the listener rule that routes test traffic.
    alternateTargetGroupArn string
    ARN of the alternate target group to use for Blue/Green deployments.
    productionListenerRule string
    ARN of the listener rule that routes production traffic.
    roleArn string
    ARN of the IAM role that allows ECS to manage the target groups.
    testListenerRule string
    ARN of the listener rule that routes test traffic.
    alternate_target_group_arn str
    ARN of the alternate target group to use for Blue/Green deployments.
    production_listener_rule str
    ARN of the listener rule that routes production traffic.
    role_arn str
    ARN of the IAM role that allows ECS to manage the target groups.
    test_listener_rule str
    ARN of the listener rule that routes test traffic.
    alternateTargetGroupArn String
    ARN of the alternate target group to use for Blue/Green deployments.
    productionListenerRule String
    ARN of the listener rule that routes production traffic.
    roleArn String
    ARN of the IAM role that allows ECS to manage the target groups.
    testListenerRule String
    ARN of the listener rule that routes test traffic.

    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 v7.4.0 published on Wednesday, Aug 13, 2025 by Pulumi