AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi
aws.ecs.getContainerDefinition
Explore with Pulumi AI
The ECS container definition data source allows access to details of a specific container within an AWS ECS service.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecs_mongo = aws.ecs.getContainerDefinition({
    taskDefinition: mongo.id,
    containerName: "mongodb",
});
import pulumi
import pulumi_aws as aws
ecs_mongo = aws.ecs.get_container_definition(task_definition=mongo["id"],
    container_name="mongodb")
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.GetContainerDefinition(ctx, &ecs.GetContainerDefinitionArgs{
			TaskDefinition: mongo.Id,
			ContainerName:  "mongodb",
		}, 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 ecs_mongo = Aws.Ecs.GetContainerDefinition.Invoke(new()
    {
        TaskDefinition = mongo.Id,
        ContainerName = "mongodb",
    });
});
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.GetContainerDefinitionArgs;
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 ecs-mongo = EcsFunctions.getContainerDefinition(GetContainerDefinitionArgs.builder()
            .taskDefinition(mongo.id())
            .containerName("mongodb")
            .build());
    }
}
variables:
  ecs-mongo:
    fn::invoke:
      function: aws:ecs:getContainerDefinition
      arguments:
        taskDefinition: ${mongo.id}
        containerName: mongodb
Using getContainerDefinition
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 getContainerDefinition(args: GetContainerDefinitionArgs, opts?: InvokeOptions): Promise<GetContainerDefinitionResult>
function getContainerDefinitionOutput(args: GetContainerDefinitionOutputArgs, opts?: InvokeOptions): Output<GetContainerDefinitionResult>def get_container_definition(container_name: Optional[str] = None,
                             task_definition: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetContainerDefinitionResult
def get_container_definition_output(container_name: Optional[pulumi.Input[str]] = None,
                             task_definition: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetContainerDefinitionResult]func GetContainerDefinition(ctx *Context, args *GetContainerDefinitionArgs, opts ...InvokeOption) (*GetContainerDefinitionResult, error)
func GetContainerDefinitionOutput(ctx *Context, args *GetContainerDefinitionOutputArgs, opts ...InvokeOption) GetContainerDefinitionResultOutput> Note: This function is named GetContainerDefinition in the Go SDK.
public static class GetContainerDefinition 
{
    public static Task<GetContainerDefinitionResult> InvokeAsync(GetContainerDefinitionArgs args, InvokeOptions? opts = null)
    public static Output<GetContainerDefinitionResult> Invoke(GetContainerDefinitionInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetContainerDefinitionResult> getContainerDefinition(GetContainerDefinitionArgs args, InvokeOptions options)
public static Output<GetContainerDefinitionResult> getContainerDefinition(GetContainerDefinitionArgs args, InvokeOptions options)
fn::invoke:
  function: aws:ecs/getContainerDefinition:getContainerDefinition
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Container
Name string - Name of the container definition
 - Task
Definition string - ARN of the task definition which contains the container
 
- Container
Name string - Name of the container definition
 - Task
Definition string - ARN of the task definition which contains the container
 
- container
Name String - Name of the container definition
 - task
Definition String - ARN of the task definition which contains the container
 
- container
Name string - Name of the container definition
 - task
Definition string - ARN of the task definition which contains the container
 
- container_
name str - Name of the container definition
 - task_
definition str - ARN of the task definition which contains the container
 
- container
Name String - Name of the container definition
 - task
Definition String - ARN of the task definition which contains the container
 
getContainerDefinition Result
The following output properties are available:
- Container
Name string - Cpu int
 - CPU limit for this container definition
 - Disable
Networking bool - Indicator if networking is disabled
 - Docker
Labels Dictionary<string, string> - Set docker labels
 - Environment Dictionary<string, string>
 - Environment in use
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Image string
 - Docker image in use, including the digest
 - Image
Digest string - Digest of the docker image in use
 - Memory int
 - Memory limit for this container definition
 - Memory
Reservation int - Soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory to this soft limit
 - Task
Definition string 
- Container
Name string - Cpu int
 - CPU limit for this container definition
 - Disable
Networking bool - Indicator if networking is disabled
 - Docker
Labels map[string]string - Set docker labels
 - Environment map[string]string
 - Environment in use
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Image string
 - Docker image in use, including the digest
 - Image
Digest string - Digest of the docker image in use
 - Memory int
 - Memory limit for this container definition
 - Memory
Reservation int - Soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory to this soft limit
 - Task
Definition string 
- container
Name String - cpu Integer
 - CPU limit for this container definition
 - disable
Networking Boolean - Indicator if networking is disabled
 - docker
Labels Map<String,String> - Set docker labels
 - environment Map<String,String>
 - Environment in use
 - id String
 - The provider-assigned unique ID for this managed resource.
 - image String
 - Docker image in use, including the digest
 - image
Digest String - Digest of the docker image in use
 - memory Integer
 - Memory limit for this container definition
 - memory
Reservation Integer - Soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory to this soft limit
 - task
Definition String 
- container
Name string - cpu number
 - CPU limit for this container definition
 - disable
Networking boolean - Indicator if networking is disabled
 - docker
Labels {[key: string]: string} - Set docker labels
 - environment {[key: string]: string}
 - Environment in use
 - id string
 - The provider-assigned unique ID for this managed resource.
 - image string
 - Docker image in use, including the digest
 - image
Digest string - Digest of the docker image in use
 - memory number
 - Memory limit for this container definition
 - memory
Reservation number - Soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory to this soft limit
 - task
Definition string 
- container_
name str - cpu int
 - CPU limit for this container definition
 - disable_
networking bool - Indicator if networking is disabled
 - docker_
labels Mapping[str, str] - Set docker labels
 - environment Mapping[str, str]
 - Environment in use
 - id str
 - The provider-assigned unique ID for this managed resource.
 - image str
 - Docker image in use, including the digest
 - image_
digest str - Digest of the docker image in use
 - memory int
 - Memory limit for this container definition
 - memory_
reservation int - Soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory to this soft limit
 - task_
definition str 
- container
Name String - cpu Number
 - CPU limit for this container definition
 - disable
Networking Boolean - Indicator if networking is disabled
 - docker
Labels Map<String> - Set docker labels
 - environment Map<String>
 - Environment in use
 - id String
 - The provider-assigned unique ID for this managed resource.
 - image String
 - Docker image in use, including the digest
 - image
Digest String - Digest of the docker image in use
 - memory Number
 - Memory limit for this container definition
 - memory
Reservation Number - Soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory to this soft limit
 - task
Definition String 
Package Details
- Repository
 - AWS Classic pulumi/pulumi-aws
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
awsTerraform Provider.