MDAA TS Docs
    Preparing search index...

    A construct for creating a compliant ECS fargateservice resource.

    Hierarchy

    • FargateService
      • MdaaECSFargateService
    Index

    Constructors

    Properties

    _serviceConnectConfig?: ServiceConnectConfigurationProperty

    The service connect configuration for this service.

    cloudmapService?: Service

    The details of the AWS Cloud Map service.

    cluster: ICluster

    The cluster that hosts the service.

    connections: Connections

    The security groups which manage the allowed network traffic for the service.

    deploymentAlarms?: DeploymentAlarmsProperty

    The deployment alarms property - this will be rendered directly and lazily as the CfnService.alarms property.

    env: ResourceEnvironment

    The environment this resource belongs to. For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

    loadBalancers: LoadBalancerProperty[]

    A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

    networkConfiguration?: NetworkConfigurationProperty

    A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.

    node: Node

    The tree node.

    physicalName: string

    Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.

    This value will resolve to one of the following:

    • a concrete value (e.g. "my-awesome-bucket")
    • undefined, when a name should be generated by CloudFormation
    • a concrete name generated automatically during synthesis, in cross-environment scenarios.
    serviceArn: string

    The Amazon Resource Name (ARN) of the service.

    serviceName: string

    The name of the service.

    serviceRegistries: ServiceRegistryProperty[]

    The details of the service discovery registries to assign to this service. For more information, see Service Discovery.

    stack: Stack

    The stack in which this resource is defined.

    taskDefinition: TaskDefinition

    The task definition to use for tasks in the service.

    PROPERTY_INJECTION_ID: string

    Uniquely identifies this class.

    Accessors

    • get cloudMapService(): IService | undefined

      The CloudMap service created for this service, if any.

      Returns IService | undefined

    Methods

    • Internal

      Called when this resource is referenced across environments (account/region) to order to request that a physical name will be generated for this resource during synthesis, so the resource can be referenced through its absolute name/arn.

      Returns void

    • Add a deployment lifecycle hook target

      Parameters

      • target: IDeploymentLifecycleHookTarget

        The lifecycle hook target to add

      Returns void

    • Adds a volume to the Service.

      Parameters

      • volume: ServiceManagedVolume

      Returns void

    • Apply the given removal policy to this resource

      The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

      The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

      Parameters

      • policy: RemovalPolicy

      Returns void

    • Associates this service with a CloudMap service

      Parameters

      • options: AssociateCloudMapServiceOptions

      Returns void

    • This method is called to attach this service to an Application Load Balancer.

      Don't call this function directly. Instead, call listener.addTargets() to add this service to a load balancer.

      Parameters

      • targetGroup: IApplicationTargetGroup

      Returns LoadBalancerTargetProps

    • Registers the service as a target of a Classic Load Balancer (CLB).

      Don't call this. Call loadBalancer.addTarget() instead.

      Parameters

      • loadBalancer: LoadBalancer

      Returns void

    • This method is called to attach this service to a Network Load Balancer.

      Don't call this function directly. Instead, call listener.addTargets() to add this service to a load balancer.

      Parameters

      • targetGroup: INetworkTargetGroup

      Returns LoadBalancerTargetProps

    • An attribute representing the minimum and maximum task count for an AutoScalingGroup.

      Parameters

      • props: EnableScalingProps

      Returns ScalableTaskCount

    • This method is called to create a networkConfiguration.

      Parameters

      • vpc: IVpc
      • OptionalassignPublicIp: boolean
      • OptionalvpcSubnets: SubnetSelection
      • OptionalsecurityGroups: ISecurityGroup[]

      Returns void

    • Enable CloudMap service discovery for the service

      Parameters

      • options: CloudMapOptions

      Returns Service

      The created CloudMap service

    • Enable Deployment Alarms which take advantage of arbitrary alarms and configure them after service initialization. If you have already enabled deployment alarms, this function can be used to tell ECS about additional alarms that should interrupt a deployment.

      New alarms specified in subsequent calls of this function will be appended to the existing list of alarms.

      The same Alarm Behavior must be used on all deployment alarms. If you specify different AlarmBehavior values in multiple calls to this function, or the Alarm Behavior used here doesn't match the one used in the service constructor, an error will be thrown.

      If the alarm's metric references the service, you cannot pass Alarm.alarmName here. That will cause a circular dependency between the service and its deployment alarm. See this package's README for options to alarm on service metrics, and avoid this circular dependency.

      Parameters

      • alarmNames: string[]
      • Optionaloptions: DeploymentAlarmOptions

      Returns void

    • Enable Service Connect on this service.

      Parameters

      • Optionalconfig: ServiceConnectProps

      Returns void

    • Returns string

    • Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).

      Normally, this token will resolve to arnAttr, but if the resource is referenced across environments, arnComponents will be used to synthesize a concrete ARN with the resource's physical name. Make sure to reference this.physicalName in arnComponents.

      Parameters

      • arnAttr: string

        The CFN attribute which resolves to the ARN of the resource. Commonly it will be called "Arn" (e.g. resource.attrArn), but sometimes it's the CFN resource's ref.

      • arnComponents: ArnComponents

        The format of the ARN of this resource. You must reference this.physicalName somewhere within the ARN in order for cross-environment references to work.

      Returns string

    • Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).

      Normally, this token will resolve to nameAttr, but if the resource is referenced across environments, it will be resolved to this.physicalName, which will be a concrete name.

      Parameters

      • nameAttr: string

        The CFN attribute which resolves to the resource's name. Commonly this is the resource's ref.

      Returns string

    • Checks if the service is using the ECS deployment controller.

      Returns boolean

      true if the service is using the ECS deployment controller or if no deployment controller is specified (defaults to ECS)

    • Return a load balancing target for a specific container and port.

      Use this function to create a load balancer target if you want to load balance to another container than the first essential container or the first mapped port on the container.

      Use the return value of this function where you would normally use a load balancer target, instead of the Service object itself.

      Parameters

      • options: LoadBalancerTargetOptions

      Returns IEcsLoadBalancerTarget

      declare const listener: elbv2.ApplicationListener;
      declare const service: ecs.BaseService;
      listener.addTargets('ECS', {
      port: 80,
      targets: [service.loadBalancerTarget({
      containerName: 'MyContainer',
      containerPort: 1234,
      })],
      });
    • This method returns the specified CloudWatch metric name for this service.

      Parameters

      • metricName: string
      • Optionalprops: MetricOptions

      Returns Metric

    • This method returns the CloudWatch metric for this service's CPU utilization.

      Parameters

      • Optionalprops: MetricOptions

      Returns Metric

      average over 5 minutes
      
    • This method returns the CloudWatch metric for this service's memory utilization.

      Parameters

      • Optionalprops: MetricOptions

      Returns Metric

      average over 5 minutes
      
    • Use this function to create all load balancer targets to be registered in this service, add them to target groups, and attach target groups to listeners accordingly.

      Alternatively, you can use listener.addTargets() to create targets and add them to target groups.

      Parameters

      • ...targets: EcsTarget[]

      Returns void

      declare const listener: elbv2.ApplicationListener;
      declare const service: ecs.BaseService;
      service.registerLoadBalancerTargets(
      {
      containerName: 'web',
      containerPort: 80,
      newTargetGroupId: 'ECS',
      listener: ecs.ListenerConfig.applicationListener(listener, {
      protocol: elbv2.ApplicationProtocol.HTTPS
      }),
      },
      )
    • Returns a string representation of this construct.

      Returns string

    • Imports from the specified service ARN.

      Parameters

      • scope: Construct
      • id: string
      • fargateServiceArn: string

      Returns IFargateService

    • Imports from the specified service attributes.

      Parameters

      • scope: Construct
      • id: string
      • attrs: FargateServiceAttributes

      Returns IBaseService

    • Import an existing ECS/Fargate Service using the service cluster format. The format is the "new" format "arn:aws:ecs:region:aws_account_id:service/cluster-name/service-name".

      Parameters

      • scope: Construct
      • id: string
      • serviceArn: string

      Returns IBaseService

    • Checks if x is a construct.

      Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

      Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

      Parameters

      • x: any

        Any object

      Returns x is Construct

      true if x is an object created from a class which extends Construct.

    • Returns true if the construct was created by CDK, and false otherwise

      Parameters

      • construct: IConstruct

      Returns boolean

    • Check whether the given construct is a Resource

      Parameters

      • construct: IConstruct

      Returns construct is Resource