QueueProcessingServiceBaseProps Struct
The properties for the base QueueProcessingEc2Service or QueueProcessingFargateService 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_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_ecs_patterns as ecs_patterns } from 'aws-cdk-lib';
import { aws_sqs as sqs } from 'aws-cdk-lib';
declare const cluster: ecs.Cluster;
declare const containerImage: ecs.ContainerImage;
declare const logDriver: ecs.LogDriver;
declare const queue: sqs.Queue;
declare const secret: ecs.Secret;
declare const vpc: ec2.Vpc;
const queueProcessingServiceBaseProps: ecs_patterns.QueueProcessingServiceBaseProps = {
capacityProviderStrategies: [{
capacityProvider: 'capacityProvider',
// the properties below are optional
base: 123,
weight: 123,
}],
circuitBreaker: {
enable: false,
rollback: false,
},
cluster: cluster,
command: ['command'],
cooldown: cdk.Duration.minutes(30),
cpuTargetUtilizationPercent: 123,
deploymentController: {
type: ecs.DeploymentControllerType.ECS,
},
disableCpuBasedScaling: false,
enableECSManagedTags: false,
enableExecuteCommand: false,
enableLogging: false,
environment: {
environmentKey: 'environment',
},
family: 'family',
image: containerImage,
logDriver: logDriver,
maxHealthyPercent: 123,
maxReceiveCount: 123,
maxScalingCapacity: 123,
minHealthyPercent: 123,
minScalingCapacity: 123,
propagateTags: ecs.PropagatedTagSource.SERVICE,
queue: queue,
retentionPeriod: cdk.Duration.minutes(30),
scalingSteps: [{
change: 123,
// the properties below are optional
lower: 123,
upper: 123,
}],
secrets: {
secretsKey: secret,
},
serviceName: 'serviceName',
visibilityTimeout: cdk.Duration.minutes(30),
vpc: vpc,
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_ecs as ecs
from aws_cdk import aws_ecs_patterns as ecs_patterns
from aws_cdk import aws_sqs as sqs
# cluster: ecs.Cluster
# container_image: ecs.ContainerImage
# log_driver: ecs.LogDriver
# queue: sqs.Queue
# secret: ecs.Secret
# vpc: ec2.Vpc
queue_processing_service_base_props = ecs_patterns.QueueProcessingServiceBaseProps(
capacity_provider_strategies=[ecs.CapacityProviderStrategy(
capacity_provider="capacityProvider",
# the properties below are optional
base=123,
weight=123
)],
circuit_breaker=ecs.DeploymentCircuitBreaker(
enable=False,
rollback=False
),
cluster=cluster,
command=["command"],
cooldown=cdk.Duration.minutes(30),
cpu_target_utilization_percent=123,
deployment_controller=ecs.DeploymentController(
type=ecs.DeploymentControllerType.ECS
),
disable_cpu_based_scaling=False,
enable_ecs_managed_tags=False,
enable_execute_command=False,
enable_logging=False,
environment={
"environment_key": "environment"
},
family="family",
image=container_image,
log_driver=log_driver,
max_healthy_percent=123,
max_receive_count=123,
max_scaling_capacity=123,
min_healthy_percent=123,
min_scaling_capacity=123,
propagate_tags=ecs.PropagatedTagSource.SERVICE,
queue=queue,
retention_period=cdk.Duration.minutes(30),
scaling_steps=[cdk.aws_applicationautoscaling.ScalingInterval(
change=123,
# the properties below are optional
lower=123,
upper=123
)],
secrets={
"secrets_key": secret
},
service_name="serviceName",
visibility_timeout=cdk.Duration.minutes(30),
vpc=vpc
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.ecs.*;
import software.amazon.awscdk.services.ecs.patterns.*;
import software.amazon.awscdk.services.sqs.*;
Cluster cluster;
ContainerImage containerImage;
LogDriver logDriver;
Queue queue;
Secret secret;
Vpc vpc;
QueueProcessingServiceBaseProps queueProcessingServiceBaseProps = QueueProcessingServiceBaseProps.builder()
.capacityProviderStrategies(List.of(CapacityProviderStrategy.builder()
.capacityProvider("capacityProvider")
// the properties below are optional
.base(123)
.weight(123)
.build()))
.circuitBreaker(DeploymentCircuitBreaker.builder()
.enable(false)
.rollback(false)
.build())
.cluster(cluster)
.command(List.of("command"))
.cooldown(Duration.minutes(30))
.cpuTargetUtilizationPercent(123)
.deploymentController(DeploymentController.builder()
.type(DeploymentControllerType.ECS)
.build())
.disableCpuBasedScaling(false)
.enableECSManagedTags(false)
.enableExecuteCommand(false)
.enableLogging(false)
.environment(Map.of(
"environmentKey", "environment"))
.family("family")
.image(containerImage)
.logDriver(logDriver)
.maxHealthyPercent(123)
.maxReceiveCount(123)
.maxScalingCapacity(123)
.minHealthyPercent(123)
.minScalingCapacity(123)
.propagateTags(PropagatedTagSource.SERVICE)
.queue(queue)
.retentionPeriod(Duration.minutes(30))
.scalingSteps(List.of(ScalingInterval.builder()
.change(123)
// the properties below are optional
.lower(123)
.upper(123)
.build()))
.secrets(Map.of(
"secretsKey", secret))
.serviceName("serviceName")
.visibilityTimeout(Duration.minutes(30))
.vpc(vpc)
.build();
// Install: dotnet add package Amazon.CDK.Lib
// 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.EC2;
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.AWS.ECS.Patterns;
using Amazon.CDK.AWS.SQS;
Cluster cluster;
ContainerImage containerImage;
LogDriver logDriver;
Queue queue;
Secret secret;
Vpc vpc;
var queueProcessingServiceBaseProps = new QueueProcessingServiceBaseProps {
CapacityProviderStrategies = new [] { new CapacityProviderStrategy {
CapacityProvider = "capacityProvider",
// the properties below are optional
Base = 123,
Weight = 123
} },
CircuitBreaker = new DeploymentCircuitBreaker {
Enable = false,
Rollback = false
},
Cluster = cluster,
Command = new [] { "command" },
Cooldown = Duration.Minutes(30),
CpuTargetUtilizationPercent = 123,
DeploymentController = new DeploymentController {
Type = DeploymentControllerType.ECS
},
DisableCpuBasedScaling = false,
EnableECSManagedTags = false,
EnableExecuteCommand = false,
EnableLogging = false,
Environment = new Dictionary<string, string> {
{ "environmentKey", "environment" }
},
Family = "family",
Image = containerImage,
LogDriver = logDriver,
MaxHealthyPercent = 123,
MaxReceiveCount = 123,
MaxScalingCapacity = 123,
MinHealthyPercent = 123,
MinScalingCapacity = 123,
PropagateTags = PropagatedTagSource.SERVICE,
Queue = queue,
RetentionPeriod = Duration.Minutes(30),
ScalingSteps = new [] { new ScalingInterval {
Change = 123,
// the properties below are optional
Lower = 123,
Upper = 123
} },
Secrets = new Dictionary<string, Secret> {
{ "secretsKey", secret }
},
ServiceName = "serviceName",
VisibilityTimeout = Duration.Minutes(30),
Vpc = vpc
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var cluster Cluster
var containerImage ContainerImage
var logDriver LogDriver
var queue Queue
var secret Secret
var vpc Vpc
queueProcessingServiceBaseProps := &QueueProcessingServiceBaseProps{
CapacityProviderStrategies: []CapacityProviderStrategy{
&CapacityProviderStrategy{
CapacityProvider: jsii.String("capacityProvider"),
// the properties below are optional
Base: jsii.Number(123),
Weight: jsii.Number(123),
},
},
CircuitBreaker: &DeploymentCircuitBreaker{
Enable: jsii.Boolean(false),
Rollback: jsii.Boolean(false),
},
Cluster: cluster,
Command: []*string{
jsii.String("command"),
},
Cooldown: cdk.Duration_Minutes(jsii.Number(30)),
CpuTargetUtilizationPercent: jsii.Number(123),
DeploymentController: &DeploymentController{
Type: awscdk.Aws_ecs.DeploymentControllerType_ECS,
},
DisableCpuBasedScaling: jsii.Boolean(false),
EnableECSManagedTags: jsii.Boolean(false),
EnableExecuteCommand: jsii.Boolean(false),
EnableLogging: jsii.Boolean(false),
Environment: map[string]*string{
"environmentKey": jsii.String("environment"),
},
Family: jsii.String("family"),
Image: containerImage,
LogDriver: logDriver,
MaxHealthyPercent: jsii.Number(123),
MaxReceiveCount: jsii.Number(123),
MaxScalingCapacity: jsii.Number(123),
MinHealthyPercent: jsii.Number(123),
MinScalingCapacity: jsii.Number(123),
PropagateTags: awscdk.*Aws_ecs.PropagatedTagSource_SERVICE,
Queue: queue,
RetentionPeriod: cdk.Duration_*Minutes(jsii.Number(30)),
ScalingSteps: []ScalingInterval{
&ScalingInterval{
Change: jsii.Number(123),
// the properties below are optional
Lower: jsii.Number(123),
Upper: jsii.Number(123),
},
},
Secrets: map[string]Secret{
"secretsKey": secret,
},
ServiceName: jsii.String("serviceName"),
VisibilityTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
Vpc: vpc,
}
Properties
capacityProviderStrategiesoptionalCapacityProviderStrategy[]capacity_provider_strategiesoptionaltyping.List[CapacityProviderStrategy]capacityProviderStrategiesoptionalList<CapacityProviderStrategy>CapacityProviderStrategiesoptionalCapacityProviderStrategy[]CapacityProviderStrategiesoptional*[]CapacityProviderStrategy= undefined#circuitBreakeroptionalDeploymentCircuitBreakercircuit_breakeroptionalDeploymentCircuitBreakercircuitBreakeroptionalDeploymentCircuitBreakerCircuitBreakeroptionalDeploymentCircuitBreakerCircuitBreakeroptionalDeploymentCircuitBreaker= disabled#If this property is defined, circuit breaker will be implicitly enabled.
clusteroptionalIClusterclusteroptionalIClusterclusteroptionalIClusterClusteroptionalIClusterClusteroptionalICluster#Default: create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you.
If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc.
commandoptionalstring[]commandoptionaltyping.List[str]commandoptionalList<String>Commandoptionalstring[]Commandoptional*[]*string#Default: CMD value built into container image.
If you provide a shell command as a single string, you have to quote command-line arguments.
cooldownoptionalDurationcooldownoptionalDurationcooldownoptionalDurationCooldownoptionalDurationCooldownoptionalDuration#Default: 300 seconds
Subsequent scale outs during the cooldown period are squashed so that only the biggest scale out happens.
Subsequent scale ins during the cooldown period are ignored.
cpuTargetUtilizationPercentoptionalnumbercpu_target_utilization_percentoptionalint | floatcpuTargetUtilizationPercentoptionalNumberCpuTargetUtilizationPercentoptionaldoubleCpuTargetUtilizationPercentoptional*float64= 50#deploymentControlleroptionalDeploymentControllerdeployment_controlleroptionalDeploymentControllerdeploymentControlleroptionalDeploymentControllerDeploymentControlleroptionalDeploymentControllerDeploymentControlleroptionalDeploymentController#Default: Rolling update (ECS)
For more information, see Amazon ECS Deployment Types
disableCpuBasedScalingoptionalbooleandisable_cpu_based_scalingoptionalbooldisableCpuBasedScalingoptionalBooleanDisableCpuBasedScalingoptionalboolDisableCpuBasedScalingoptional*bool= false#enableECSManagedTagsoptionalbooleanenable_ecs_managed_tagsoptionalboolenableECSManagedTagsoptionalBooleanEnableECSManagedTagsoptionalboolEnableECSManagedTagsoptional*bool= false#For more information, see Tagging Your Amazon ECS Resources
enableExecuteCommandoptionalbooleanenable_execute_commandoptionalboolenableExecuteCommandoptionalBooleanEnableExecuteCommandoptionalboolEnableExecuteCommandoptional*bool= false#enableLoggingoptionalbooleanenable_loggingoptionalboolenableLoggingoptionalBooleanEnableLoggingoptionalboolEnableLoggingoptional*bool= true#environmentoptional{ [key: string]: string }environmentoptionaltyping.Mapping[str, str]environmentoptionalMap<String, String>EnvironmentoptionalIDictionary<string, string>Environmentoptional*map[string]*string#Default: 'QUEUE_NAME: queue.queueName'
The variable QUEUE_NAME with value queue.queueName will always be passed.
Default: Automatically generated name.
A family groups multiple versions of a task definition.
imageoptionalContainerImageimageoptionalContainerImageimageoptionalContainerImageImageoptionalContainerImageImageoptionalContainerImage#Default: the image of the task definition is used for Fargate, required otherwise
For QueueProcessingFargateService, either image or taskDefinition must be specified, but not both. For QueueProcessingEc2Service, image is required.
logDriveroptionalLogDriverlog_driveroptionalLogDriverlogDriveroptionalLogDriverLogDriveroptionalLogDriverLogDriveroptionalLogDriver#Default: AwsLogDriver if enableLogging is true
maxHealthyPercentoptionalnumbermax_healthy_percentoptionalint | floatmaxHealthyPercentoptionalNumberMaxHealthyPercentoptionaldoubleMaxHealthyPercentoptional*float64#Default: default from underlying service.
maxReceiveCountoptionalnumbermax_receive_countoptionalint | floatmaxReceiveCountoptionalNumberMaxReceiveCountoptionaldoubleMaxReceiveCountoptional*float64= 3#When this value is exceeded for a message the message will be automatically sent to the Dead Letter Queue.
If the queue construct is specified, maxReceiveCount should be omitted.
maxScalingCapacityoptionalnumbermax_scaling_capacityoptionalint | floatmaxScalingCapacityoptionalNumberMaxScalingCapacityoptionaldoubleMaxScalingCapacityoptional*float64= 2#minHealthyPercentoptionalnumbermin_healthy_percentoptionalint | floatminHealthyPercentoptionalNumberMinHealthyPercentoptionaldoubleMinHealthyPercentoptional*float64#Default: default from underlying service.
minScalingCapacityoptionalnumbermin_scaling_capacityoptionalint | floatminScalingCapacityoptionalNumberMinScalingCapacityoptionaldoubleMinScalingCapacityoptional*float64= 1#propagateTagsoptionalPropagatedTagSourcepropagate_tagsoptionalPropagatedTagSourcepropagateTagsoptionalPropagatedTagSourcePropagateTagsoptionalPropagatedTagSourcePropagateTagsoptionalPropagatedTagSource= none#Tags can only be propagated to the tasks within the service during service creation.
Default: 'SQSQueue with CloudFormation-generated name'
If specified and this is a FIFO queue, the queue name must end in the string '.fifo'. See CreateQueue
retentionPeriodoptionalDurationretention_periodoptionalDurationretentionPeriodoptionalDurationRetentionPeriodoptionalDurationRetentionPeriodoptionalDuration= Duration.days(14)#If the queue construct is specified, retentionPeriod should be omitted.
scalingStepsoptionalScalingInterval[]scaling_stepsoptionaltyping.List[ScalingInterval]scalingStepsoptionalList<ScalingInterval>ScalingStepsoptionalScalingInterval[]ScalingStepsoptional*[]ScalingInterval#Default: [{ upper: 0, change: -1 },{ lower: 100, change: +1 },{ lower: 500, change: +5 }]
Maps a range of metric values to a particular scaling behavior. See Simple and Step Scaling Policies for Amazon EC2 Auto Scaling
secretsoptional{ [key: string]: Secret }secretsoptionaltyping.Mapping[str, Secret]secretsoptionalMap<String, Secret>SecretsoptionalIDictionary<string, Secret>Secretsoptional*map[string]Secret#Default: No secret environment variables.
serviceNameoptionalstringservice_nameoptionalstrserviceNameoptionalStringServiceNameoptionalstringServiceNameoptional*string#Default: CloudFormation-generated name.
visibilityTimeoutoptionalDurationvisibility_timeoutoptionalDurationvisibilityTimeoutoptionalDurationVisibilityTimeoutoptionalDurationVisibilityTimeoutoptionalDuration= Duration.seconds(30)#notes
After dequeuing, the processor has this much time to handle the message and delete it from the queue before it becomes visible again for dequeueing by another processor. Values must be between 0 and (12 hours).
If the queue construct is specified, visibilityTimeout should be omitted.
Default: uses the VPC defined in the cluster or creates a new VPC.
If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster.