AwsEcs

Service-level AWS ECS component.

Remarks

This is the primary public component resource for the package. It orchestrates one ECS capability per instance: cluster, task definition, service, or capacity provider.

Naming:

  • Root: type ${namespace}:aws:AwsEcs; capability ecs; identity is the raw selected args.cluster.identity, args.taskDefinition.name, args.service.service.name, or args.capacityProvider.name; target ${env}-${projectHash}-ecs-${sanitiseNamePart(identity)}; punctuation-only identities are rejected.
  • Nested capability roots and provider children are documented in their owning capability classes.
  • Provider names: Cluster name uses stackOnly through buildNameByStyleWithRuntimeContext; task-definition family, service name, and capacity-provider name use stackAndPurpose through buildAwsNameFromCamelCasePurpose. Each purpose comes from its owning args field and has the ECS 255-character limit budgeted as maxLength: 242.

Example

CODE
const cluster = new AwsEcs({
  cluster: {
    identity: 'app-cluster',
  },
});

const service = new AwsEcs({
  service: {
    cluster,
    taskDefinition: {
      name: 'api',
      cpu: '256',
      memory: '512',
      networkMode: 'awsvpc',
      requiresCompatibilities: ['FARGATE'],
      executionRole: 'ecsTaskExecutionRoleName',
      taskRole: 'ecsTaskRoleName',
      containerDefinitions: JSON.stringify([{ name: 'api', image: 'nginx', essential: true }]),
    },
    service: {
      name: 'api',
      desiredCount: 1,
    },
  },
});

Constructors

new AwsEcs( args: AwsEcsArgs, options?: ComponentResourceOptions, ): AwsEcs

Parameters

  • args (AwsEcsArgs) — Service-level ECS capability inputs. Use new AwsEcs(args, options).The component logical name is derived from capability identity fields:These identity fields must be non-empty synchronous plain string values (not Input/Output/promise/apply-derived) and are validated fail-fast before resource construction. They are distinct from AWS provider resource-name inputs.
  • options (ComponentResourceOptions, optional) — Optional settings controlling resource behaviour.

Returns

AwsEcs

Hierarchy

  • ComponentResource
  • AwsEcs

Properties

capacityProvider: AwsEcsCapacityProvider

readonly

Optional ECS capacity-provider capability created by this component.

cluster: AwsEcsCluster

readonly

Optional ECS cluster capability created by this component.

service: AwsEcsService

readonly

Optional ECS service capability created by this component.

taskDefinition: AwsEcsTaskDefinition

readonly

Optional ECS task-definition capability created by this component.

urn: Output<string>

readonly

Inherited from urn

The stable logical URN used to distinctly address a resource, both before and after deployments.

Methods

getData(): Promise<any>

protectedasync

Inherited from getData

Retrieves the data produces by initialize. The data is immediately available in a derived class's constructor after the super(...) call to ComponentResource.

Returns

  • Promise<any>

getProvider(moduleMember: string): ProviderResource | undefined

Inherited from getProvider

Returns the provider for the given module member, if one exists.

Parameters

  • moduleMember (string)

Returns

  • ProviderResource | undefined

initialize( args: Inputs, opts?: ComponentResourceOptions, name?: string, type?: string, ): Promise<any>

protectedasync

Inherited from initialize

Can be overridden by a subclass to asynchronously initialize data for this component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use getData.

Parameters

  • args (Inputs)
  • opts (ComponentResourceOptions, optional)
  • name (string, optional)
  • type (string, optional)

Returns

  • Promise<any>

registerOutputs( outputs?: Inputs | Promise<Inputs> | Output<Inputs>, ): void

protected

Inherited from registerOutputs

Registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.

Component resources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.

Parameters

  • outputs (Inputs | Promise<Inputs> | Output<Inputs>, optional)

Returns

  • void

Static Methods

isInstance(obj: any): obj is ComponentResource<any>

static

Inherited from isInstance

Returns true if the given object is a CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

Parameters

  • obj (any)

Returns

  • obj is ComponentResource<any>