Interface IBaseServiceOptions
The properties for the base Ec2Service or FargateService service.
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IBaseServiceOptions
Syntax (vb)
Public Interface IBaseServiceOptions
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.AWS.ServiceDiscovery;
Cluster cluster;
ContainerDefinition containerDefinition;
LogDriver logDriver;
INamespace namespace;
ServiceManagedVolume serviceManagedVolume;
TaskDefinitionRevision taskDefinitionRevision;
var baseServiceOptions = new BaseServiceOptions {
Cluster = cluster,
// the properties below are optional
CapacityProviderStrategies = new [] { new CapacityProviderStrategy {
CapacityProvider = "capacityProvider",
// the properties below are optional
Base = 123,
Weight = 123
} },
CircuitBreaker = new DeploymentCircuitBreaker {
Enable = false,
Rollback = false
},
CloudMapOptions = new CloudMapOptions {
CloudMapNamespace = namespace,
Container = containerDefinition,
ContainerPort = 123,
DnsRecordType = DnsRecordType.A,
DnsTtl = Duration.Minutes(30),
FailureThreshold = 123,
Name = "name"
},
DeploymentAlarms = new DeploymentAlarmConfig {
AlarmNames = new [] { "alarmNames" },
// the properties below are optional
Behavior = AlarmBehavior.ROLLBACK_ON_ALARM
},
DeploymentController = new DeploymentController {
Type = DeploymentControllerType.ECS
},
DesiredCount = 123,
EnableECSManagedTags = false,
EnableExecuteCommand = false,
HealthCheckGracePeriod = Duration.Minutes(30),
MaxHealthyPercent = 123,
MinHealthyPercent = 123,
PropagateTags = PropagatedTagSource.SERVICE,
ServiceConnectConfiguration = new ServiceConnectProps {
LogDriver = logDriver,
Namespace = "namespace",
Services = new [] { new ServiceConnectService {
PortMappingName = "portMappingName",
// the properties below are optional
DiscoveryName = "discoveryName",
DnsName = "dnsName",
IdleTimeout = Duration.Minutes(30),
IngressPortOverride = 123,
PerRequestTimeout = Duration.Minutes(30),
Port = 123
} }
},
ServiceName = "serviceName",
TaskDefinitionRevision = taskDefinitionRevision,
VolumeConfigurations = new [] { serviceManagedVolume }
};
Synopsis
Properties
CapacityProviderStrategies | A list of Capacity Provider strategies used to place a service. |
CircuitBreaker | Whether to enable the deployment circuit breaker. |
CloudMapOptions | The options for configuring an Amazon ECS service to use service discovery. |
Cluster | The name of the cluster that hosts the service. |
DeploymentAlarms | The alarm(s) to monitor during deployment, and behavior to apply if at least one enters a state of alarm during the deployment or bake time. |
DeploymentController | Specifies which deployment controller to use for the service. |
DesiredCount | The desired number of instantiations of the task definition to keep running on the service. |
EnableECSManagedTags | Specifies whether to enable Amazon ECS managed tags for the tasks within the service. |
EnableExecuteCommand | Whether to enable the ability to execute into a container. |
HealthCheckGracePeriod | The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. |
MaxHealthyPercent | The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. |
MinHealthyPercent | The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. |
PropagateTags | Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. |
ServiceConnectConfiguration | Configuration for Service Connect. |
ServiceName | The name of the service. |
TaskDefinitionRevision | Revision number for the task definition or |
VolumeConfigurations | Configuration details for a volume used by the service. |
Properties
CapacityProviderStrategies
A list of Capacity Provider strategies used to place a service.
virtual ICapacityProviderStrategy[] CapacityProviderStrategies { get; }
Property Value
Remarks
Default: - undefined
CircuitBreaker
Whether to enable the deployment circuit breaker.
virtual IDeploymentCircuitBreaker CircuitBreaker { get; }
Property Value
Remarks
If this property is defined, circuit breaker will be implicitly enabled.
Default: - disabled
CloudMapOptions
The options for configuring an Amazon ECS service to use service discovery.
virtual ICloudMapOptions CloudMapOptions { get; }
Property Value
Remarks
Default: - AWS Cloud Map service discovery is not enabled.
Cluster
DeploymentAlarms
The alarm(s) to monitor during deployment, and behavior to apply if at least one enters a state of alarm during the deployment or bake time.
virtual IDeploymentAlarmConfig DeploymentAlarms { get; }
Property Value
Remarks
Default: - No alarms will be monitored during deployment.
DeploymentController
Specifies which deployment controller to use for the service.
virtual IDeploymentController DeploymentController { get; }
Property Value
Remarks
For more information, see Amazon ECS Deployment Types
Default: - Rolling update (ECS)
DesiredCount
The desired number of instantiations of the task definition to keep running on the service.
virtual Nullable<double> DesiredCount { get; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - When creating the service, default is 1; when updating the service, default uses the current task number.
EnableECSManagedTags
Specifies whether to enable Amazon ECS managed tags for the tasks within the service.
virtual Nullable<bool> EnableECSManagedTags { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
For more information, see Tagging Your Amazon ECS Resources
Default: false
EnableExecuteCommand
Whether to enable the ability to execute into a container.
virtual Nullable<bool> EnableExecuteCommand { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - undefined
HealthCheckGracePeriod
The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started.
virtual Duration HealthCheckGracePeriod { get; }
Property Value
Remarks
Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set
MaxHealthyPercent
The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment.
virtual Nullable<double> MaxHealthyPercent { get; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - 100 if daemon, otherwise 200
MinHealthyPercent
The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment.
virtual Nullable<double> MinHealthyPercent { get; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - 0 if daemon, otherwise 50
PropagateTags
Specifies whether to propagate the tags from the task definition or the service to the tasks in the service.
virtual Nullable<PropagatedTagSource> PropagateTags { get; }
Property Value
System.Nullable<PropagatedTagSource>
Remarks
Valid values are: PropagatedTagSource.SERVICE, PropagatedTagSource.TASK_DEFINITION or PropagatedTagSource.NONE
Default: PropagatedTagSource.NONE
ServiceConnectConfiguration
Configuration for Service Connect.
virtual IServiceConnectProps ServiceConnectConfiguration { get; }
Property Value
Remarks
Default: No ports are advertised via Service Connect on this service, and the service cannot make requests to other services via Service Connect.
ServiceName
The name of the service.
virtual string ServiceName { get; }
Property Value
System.String
Remarks
Default: - CloudFormation-generated name.
TaskDefinitionRevision
Revision number for the task definition or latest
to use the latest active task revision.
virtual TaskDefinitionRevision TaskDefinitionRevision { get; }
Property Value
Remarks
Default: - Uses the revision of the passed task definition deployed by CloudFormation
VolumeConfigurations
Configuration details for a volume used by the service.
virtual ServiceManagedVolume[] VolumeConfigurations { get; }
Property Value
Remarks
This allows you to specify details about the EBS volume that can be attched to ECS tasks.
Default: - undefined