BaseServiceOptions Struct
The properties for the base Ec2Service or FargateService service.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_servicediscovery as servicediscovery } from 'aws-cdk-lib';
import { aws_kms as interfaces_kms } from 'aws-cdk-lib/interfaces';
declare const cluster: ecs.Cluster;
declare const containerDefinition: ecs.ContainerDefinition;
declare const deploymentLifecycleHookTarget: ecs.IDeploymentLifecycleHookTarget;
declare const keyRef: interfaces_kms.IKeyRef;
declare const logDriver: ecs.LogDriver;
declare const namespace: servicediscovery.INamespace;
declare const role: iam.Role;
declare const serviceManagedVolume: ecs.ServiceManagedVolume;
declare const taskDefinitionRevision: ecs.TaskDefinitionRevision;
const baseServiceOptions: ecs.BaseServiceOptions = {
cluster: cluster,
// the properties below are optional
bakeTime: cdk.Duration.minutes(30),
canaryConfiguration: {
stepBakeTime: cdk.Duration.minutes(30),
stepPercent: 123,
},
capacityProviderStrategies: [{
capacityProvider: 'capacityProvider',
// the properties below are optional
base: 123,
weight: 123,
}],
circuitBreaker: {
enable: false,
rollback: false,
},
cloudMapOptions: {
cloudMapNamespace: namespace,
container: containerDefinition,
containerPort: 123,
dnsRecordType: servicediscovery.DnsRecordType.A,
dnsTtl: cdk.Duration.minutes(30),
failureThreshold: 123,
name: 'name',
},
deploymentAlarms: {
alarmNames: ['alarmNames'],
// the properties below are optional
behavior: ecs.AlarmBehavior.ROLLBACK_ON_ALARM,
},
deploymentController: {
type: ecs.DeploymentControllerType.ECS,
},
deploymentStrategy: ecs.DeploymentStrategy.ROLLING,
desiredCount: 123,
enableECSManagedTags: false,
enableExecuteCommand: false,
forceNewDeployment: {
enabled: false,
// the properties below are optional
nonce: 'nonce',
},
healthCheckGracePeriod: cdk.Duration.minutes(30),
lifecycleHooks: [deploymentLifecycleHookTarget],
linearConfiguration: {
stepBakeTime: cdk.Duration.minutes(30),
stepPercent: 123,
},
maxHealthyPercent: 123,
minHealthyPercent: 123,
propagateTags: ecs.PropagatedTagSource.SERVICE,
serviceConnectConfiguration: {
accessLogConfiguration: {
format: ecs.ServiceConnectAccessLogFormat.TEXT,
// the properties below are optional
includeQueryParameters: false,
},
logDriver: logDriver,
namespace: 'namespace',
services: [{
portMappingName: 'portMappingName',
// the properties below are optional
discoveryName: 'discoveryName',
dnsName: 'dnsName',
idleTimeout: cdk.Duration.minutes(30),
ingressPortOverride: 123,
perRequestTimeout: cdk.Duration.minutes(30),
port: 123,
tls: {
awsPcaAuthorityArn: 'awsPcaAuthorityArn',
kmsKey: keyRef,
role: role,
},
}],
},
serviceName: 'serviceName',
taskDefinitionRevision: taskDefinitionRevision,
volumeConfigurations: [serviceManagedVolume],
};
Properties
canaryConfigurationTrafficShiftConfigcanary_configurationTrafficShiftConfigcanaryConfigurationTrafficShiftConfigCanaryConfigurationTrafficShiftConfigCanaryConfigurationTrafficShiftConfig= no canary configuration#Only valid when deploymentStrategy is set to CANARY.
capacityProviderStrategiesCapacityProviderStrategy[]capacity_provider_strategiestyping.List[CapacityProviderStrategy]capacityProviderStrategiesList<CapacityProviderStrategy>CapacityProviderStrategiesCapacityProviderStrategy[]CapacityProviderStrategies*[]CapacityProviderStrategy= undefined#circuitBreakerDeploymentCircuitBreakercircuit_breakerDeploymentCircuitBreakercircuitBreakerDeploymentCircuitBreakerCircuitBreakerDeploymentCircuitBreakerCircuitBreakerDeploymentCircuitBreaker= disabled#If this property is defined, circuit breaker will be implicitly enabled.
cloudMapOptionsCloudMapOptionscloud_map_optionsCloudMapOptionscloudMapOptionsCloudMapOptionsCloudMapOptionsCloudMapOptionsCloudMapOptionsCloudMapOptions= AWS Cloud Map service discovery …#default
Default: AWS Cloud Map service discovery is not enabled.
deploymentAlarmsDeploymentAlarmConfigdeployment_alarmsDeploymentAlarmConfigdeploymentAlarmsDeploymentAlarmConfigDeploymentAlarmsDeploymentAlarmConfigDeploymentAlarmsDeploymentAlarmConfig= No alarms will be monitored duri…#default
Default: No alarms will be monitored during deployment.
deploymentControllerDeploymentControllerdeployment_controllerDeploymentControllerdeploymentControllerDeploymentControllerDeploymentControllerDeploymentControllerDeploymentControllerDeploymentController= Rolling update (ECS)#For more information, see Amazon ECS Deployment Types
deploymentStrategyDeploymentStrategydeployment_strategyDeploymentStrategydeploymentStrategyDeploymentStrategyDeploymentStrategyDeploymentStrategyDeploymentStrategyDeploymentStrategy= ROLLING#desiredCountnumberdesired_countint | floatdesiredCountNumberDesiredCountdoubleDesiredCount*float64= When creating the service, defau…#default
Default: When creating the service, default is 1; when updating the service, default uses the current task number.
enableECSManagedTagsbooleanenable_ecs_managed_tagsboolenableECSManagedTagsBooleanEnableECSManagedTagsboolEnableECSManagedTags*bool= false#For more information, see Tagging Your Amazon ECS Resources
enableExecuteCommandbooleanenable_execute_commandboolenableExecuteCommandBooleanEnableExecuteCommandboolEnableExecuteCommand*bool= undefined#forceNewDeploymentForceNewDeploymentforce_new_deploymentForceNewDeploymentforceNewDeploymentForceNewDeploymentForceNewDeploymentForceNewDeploymentForceNewDeploymentForceNewDeployment= no forced deployment#notes
By default, deployments aren't forced. You can use this option to start a new deployment with no service definition changes. For example, you can update a service's tasks to use a newer Docker image with the same image/tag combination (my_image:latest) or to roll Fargate tasks onto a newer platform version.
This is equivalent to calling the forceNewDeployment() method, but allows you to configure it declaratively at construction time, including the ability to explicitly disable it with enabled: false.
healthCheckGracePeriodDurationhealth_check_grace_periodDurationhealthCheckGracePeriodDurationHealthCheckGracePeriodDurationHealthCheckGracePeriodDuration= defaults to 60 seconds if at lea…#default
Default: defaults to 60 seconds if at least one load balancer is in-use and it is not already set
lifecycleHooksIDeploymentLifecycleHookTarget[]lifecycle_hookstyping.List[IDeploymentLifecycleHookTarget]lifecycleHooksList<IDeploymentLifecycleHookTarget>LifecycleHooksIDeploymentLifecycleHookTarget[]LifecycleHooks*[]IDeploymentLifecycleHookTarget= none;#linearConfigurationTrafficShiftConfiglinear_configurationTrafficShiftConfiglinearConfigurationTrafficShiftConfigLinearConfigurationTrafficShiftConfigLinearConfigurationTrafficShiftConfig= no linear configuration#Only valid when deploymentStrategy is set to LINEAR.
maxHealthyPercentnumbermax_healthy_percentint | floatmaxHealthyPercentNumberMaxHealthyPercentdoubleMaxHealthyPercent*float64= 100 if daemon, otherwise 200#minHealthyPercentnumbermin_healthy_percentint | floatminHealthyPercentNumberMinHealthyPercentdoubleMinHealthyPercent*float64= 0 if daemon, otherwise 50#propagateTagsPropagatedTagSourcepropagate_tagsPropagatedTagSourcepropagateTagsPropagatedTagSourcePropagateTagsPropagatedTagSourcePropagateTagsPropagatedTagSource= PropagatedTagSource.NONE#Valid values are: PropagatedTagSource.SERVICE, PropagatedTagSource.TASK_DEFINITION or PropagatedTagSource.NONE
serviceConnectConfigurationServiceConnectPropsservice_connect_configurationServiceConnectPropsserviceConnectConfigurationServiceConnectPropsServiceConnectConfigurationServiceConnectPropsServiceConnectConfigurationServiceConnectProps= No ports are advertised via Serv…#default
Default: No ports are advertised via Service Connect on this service, and the service cannot make requests to other services via Service Connect.
serviceNamestringservice_namestrserviceNameStringServiceNamestringServiceName*string= CloudFormation-generated name.#taskDefinitionRevisionTaskDefinitionRevisiontask_definition_revisionTaskDefinitionRevisiontaskDefinitionRevisionTaskDefinitionRevisionTaskDefinitionRevisionTaskDefinitionRevisionTaskDefinitionRevisionTaskDefinitionRevision= Uses the revision of the passed …#default
Default: Uses the revision of the passed task definition deployed by CloudFormation
volumeConfigurationsServiceManagedVolume[]volume_configurationstyping.List[ServiceManagedVolume]volumeConfigurationsList<ServiceManagedVolume>VolumeConfigurationsServiceManagedVolume[]VolumeConfigurations*[]ServiceManagedVolume= undefined#This allows you to specify details about the EBS volume that can be attached to ECS tasks.