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; capabilityecs; identity is the raw selectedargs.cluster.identity,args.taskDefinition.name,args.service.service.name, orargs.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
nameusesstackOnlythroughbuildNameByStyleWithRuntimeContext; task-definitionfamily, servicename, and capacity-providernameusestackAndPurposethroughbuildAwsNameFromCamelCasePurpose. Each purpose comes from its owning args field and has the ECS 255-character limit budgeted asmaxLength: 242.
Example
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. Usenew AwsEcs(args, options).The component logical name is derived from capability identity fields:These identity fields must be non-empty synchronous plainstringvalues (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
ComponentResourceAwsEcs
Properties
capacityProvider: AwsEcsCapacityProvider
Optional ECS capacity-provider capability created by this component.
cluster: AwsEcsCluster
Optional ECS cluster capability created by this component.
service: AwsEcsService
Optional ECS service capability created by this component.
taskDefinition: AwsEcsTaskDefinition
Optional ECS task-definition capability created by this component.
urn: Output<string>
Inherited from urn
The stable logical URN used to distinctly address a resource, both before and after deployments.
Methods
getData(): Promise<any>
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>
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
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>
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>