Show / Hide Table of Contents

Class BaseService

The base class for Ec2Service and FargateService services.

Inheritance
System.Object
Construct
Resource
BaseService
Ec2Service
FargateService
Implements
IBaseService
IService
IResource
IConstruct
Constructs.IConstruct
IDependable
IApplicationLoadBalancerTarget
INetworkLoadBalancerTarget
ILoadBalancerTarget
IConnectable
Inherited Members
Resource.IsResource(IConstruct)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(String, IArnComponents)
Resource.GetResourceNameAttribute(String)
Resource.Env
Resource.PhysicalName
Resource.Stack
Construct.IsConstruct(Object)
Construct.OnPrepare()
Construct.OnSynthesize(ISynthesisSession)
Construct.OnValidate()
Construct.Prepare()
Construct.Synthesize(ISynthesisSession)
Construct.Validate()
Construct.Node
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public abstract class BaseService : Resource, IBaseService, IService, IResource, IConstruct, IConstruct, IDependable, IApplicationLoadBalancerTarget, INetworkLoadBalancerTarget, ILoadBalancerTarget, IConnectable
Syntax (vb)
Public MustInherit Class BaseService
    Inherits Resource
    Implements IBaseService, IService, IResource, IConstruct, IConstruct, IDependable, IApplicationLoadBalancerTarget, INetworkLoadBalancerTarget, ILoadBalancerTarget, IConnectable

Synopsis

Constructors

BaseService(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

BaseService(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

BaseService(Construct, String, IBaseServiceProps, Object, TaskDefinition)

Constructs a new instance of the BaseService class.

Properties

CloudmapService
CloudMapService

The details of the AWS Cloud Map service.

Cluster

The cluster that hosts the service.

Connections

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

LoadBalancers

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

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.

ServiceArn

The Amazon Resource Name (ARN) of the service.

ServiceName

The name of the service.

ServiceRegistries

The details of the service discovery registries to assign to this service.

TaskDefinition

The task definition to use for tasks in the service.

Methods

AttachToApplicationTargetGroup(IApplicationTargetGroup)

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

AttachToClassicLB(LoadBalancer)

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

AttachToNetworkTargetGroup(INetworkTargetGroup)

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

AutoScaleTaskCount(IEnableScalingProps)

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

ConfigureAwsVpcNetworking(IVpc, Nullable<Boolean>, ISubnetSelection, ISecurityGroup)

(deprecated) This method is called to create a networkConfiguration.

ConfigureAwsVpcNetworkingWithSecurityGroups(IVpc, Nullable<Boolean>, ISubnetSelection, ISecurityGroup[])

This method is called to create a networkConfiguration.

EnableCloudMap(ICloudMapOptions)

Enable CloudMap service discovery for the service.

LoadBalancerTarget(ILoadBalancerTargetOptions)

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

Metric(String, IMetricOptions)

This method returns the specified CloudWatch metric name for this service.

MetricCpuUtilization(IMetricOptions)

This method returns the CloudWatch metric for this clusters CPU utilization.

MetricMemoryUtilization(IMetricOptions)

This method returns the CloudWatch metric for this clusters memory utilization.

RegisterLoadBalancerTargets(IEcsTarget[])

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.

Constructors

BaseService(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

protected BaseService(ByRefValue reference)
Parameters
reference Amazon.JSII.Runtime.Deputy.ByRefValue

The Javascript-owned object reference

BaseService(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

protected BaseService(DeputyBase.DeputyProps props)
Parameters
props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps

The deputy props

BaseService(Construct, String, IBaseServiceProps, Object, TaskDefinition)

Constructs a new instance of the BaseService class.

protected BaseService(Construct scope, string id, IBaseServiceProps props, object additionalProps, TaskDefinition taskDefinition)
Parameters
scope Constructs.Construct
id System.String
props IBaseServiceProps
additionalProps System.Object
taskDefinition TaskDefinition

Properties

CloudmapService

protected virtual Service CloudmapService { get; set; }
Property Value

Service

CloudMapService

The details of the AWS Cloud Map service.

public virtual IService CloudMapService { get; }
Property Value

IService

Cluster

The cluster that hosts the service.

public virtual ICluster Cluster { get; }
Property Value

ICluster

Connections

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

public virtual Connections_ Connections { get; }
Property Value

Connections_

LoadBalancers

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.

protected virtual CfnService.ILoadBalancerProperty[] LoadBalancers { get; set; }
Property Value

CfnService.ILoadBalancerProperty[]

NetworkConfiguration

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.

protected virtual CfnService.INetworkConfigurationProperty NetworkConfiguration { get; set; }
Property Value

CfnService.INetworkConfigurationProperty

ServiceArn

The Amazon Resource Name (ARN) of the service.

public virtual string ServiceArn { get; }
Property Value

System.String

ServiceName

The name of the service.

public virtual string ServiceName { get; }
Property Value

System.String

Remarks

Attribute: true

ServiceRegistries

The details of the service discovery registries to assign to this service.

protected virtual CfnService.IServiceRegistryProperty[] ServiceRegistries { get; set; }
Property Value

CfnService.IServiceRegistryProperty[]

Remarks

For more information, see Service Discovery.

TaskDefinition

The task definition to use for tasks in the service.

public virtual TaskDefinition TaskDefinition { get; }
Property Value

TaskDefinition

Methods

AttachToApplicationTargetGroup(IApplicationTargetGroup)

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

public virtual ILoadBalancerTargetProps AttachToApplicationTargetGroup(IApplicationTargetGroup targetGroup)
Parameters
targetGroup IApplicationTargetGroup
Returns

ILoadBalancerTargetProps

Remarks

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

AttachToClassicLB(LoadBalancer)

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

public virtual void AttachToClassicLB(LoadBalancer loadBalancer)
Parameters
loadBalancer LoadBalancer
Remarks

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

AttachToNetworkTargetGroup(INetworkTargetGroup)

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

public virtual ILoadBalancerTargetProps AttachToNetworkTargetGroup(INetworkTargetGroup targetGroup)
Parameters
targetGroup INetworkTargetGroup
Returns

ILoadBalancerTargetProps

Remarks

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

AutoScaleTaskCount(IEnableScalingProps)

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

public virtual ScalableTaskCount AutoScaleTaskCount(IEnableScalingProps props)
Parameters
props IEnableScalingProps
Returns

ScalableTaskCount

ConfigureAwsVpcNetworking(IVpc, Nullable<Boolean>, ISubnetSelection, ISecurityGroup)

(deprecated) This method is called to create a networkConfiguration.

protected virtual void ConfigureAwsVpcNetworking(IVpc vpc, Nullable<bool> assignPublicIp = null, ISubnetSelection vpcSubnets = null, ISecurityGroup securityGroup = null)
Parameters
vpc IVpc
assignPublicIp System.Nullable<System.Boolean>
vpcSubnets ISubnetSelection
securityGroup ISecurityGroup
Remarks

Stability: Deprecated

ConfigureAwsVpcNetworkingWithSecurityGroups(IVpc, Nullable<Boolean>, ISubnetSelection, ISecurityGroup[])

This method is called to create a networkConfiguration.

protected virtual void ConfigureAwsVpcNetworkingWithSecurityGroups(IVpc vpc, Nullable<bool> assignPublicIp = null, ISubnetSelection vpcSubnets = null, ISecurityGroup[] securityGroups = null)
Parameters
vpc IVpc
assignPublicIp System.Nullable<System.Boolean>
vpcSubnets ISubnetSelection
securityGroups ISecurityGroup[]

EnableCloudMap(ICloudMapOptions)

Enable CloudMap service discovery for the service.

public virtual Service EnableCloudMap(ICloudMapOptions options)
Parameters
options ICloudMapOptions
Returns

Service

The created CloudMap service

LoadBalancerTarget(ILoadBalancerTargetOptions)

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

public virtual IEcsLoadBalancerTarget LoadBalancerTarget(ILoadBalancerTargetOptions options)
Parameters
options ILoadBalancerTargetOptions
Returns

IEcsLoadBalancerTarget

Remarks

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.

Examples
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
listener.AddTargets("ECS", new Struct {
Port = 80,
Targets = new [] { service.LoadBalancerTarget(new Struct {
ContainerName = "MyContainer",
ContainerPort = 1234
}) }
});

Metric(String, IMetricOptions)

This method returns the specified CloudWatch metric name for this service.

public virtual Metric Metric(string metricName, IMetricOptions props = null)
Parameters
metricName System.String
props IMetricOptions
Returns

Metric

MetricCpuUtilization(IMetricOptions)

This method returns the CloudWatch metric for this clusters CPU utilization.

public virtual Metric MetricCpuUtilization(IMetricOptions props = null)
Parameters
props IMetricOptions
Returns

Metric

Remarks

Default: average over 5 minutes

MetricMemoryUtilization(IMetricOptions)

This method returns the CloudWatch metric for this clusters memory utilization.

public virtual Metric MetricMemoryUtilization(IMetricOptions props = null)
Parameters
props IMetricOptions
Returns

Metric

Remarks

Default: average over 5 minutes

RegisterLoadBalancerTargets(IEcsTarget[])

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.

public virtual void RegisterLoadBalancerTargets(params IEcsTarget[] targets)
Parameters
targets IEcsTarget[]
Remarks

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

Examples
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
service.RegisterLoadBalancerTargets(new Struct {
ContainerName = "web",
ContainerPort = 80,
NewTargetGroupId = "ECS",
Listener = ecs.ListenerConfig.ApplicationListener(listener, new Struct {
Protocol = elbv2.ApplicationProtocol.HTTPS
})
});

Implements

IBaseService
IService
IResource
IConstruct
Constructs.IConstruct
IDependable
IApplicationLoadBalancerTarget
INetworkLoadBalancerTarget
ILoadBalancerTarget
IConnectable
Back to top Generated by DocFX