interface ForceNewDeployment
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ECS.ForceNewDeployment |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#ForceNewDeployment |
Java | software.amazon.awscdk.services.ecs.ForceNewDeployment |
Python | aws_cdk.aws_ecs.ForceNewDeployment |
TypeScript (source) | aws-cdk-lib » aws_ecs » ForceNewDeployment |
Configuration for forcing a new deployment of the service.
Example
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
// Force a new deployment on every `cdk deploy` by using a time-based nonce
const service = new ecs.FargateService(this, 'Service', {
cluster,
taskDefinition,
forceNewDeployment: {
enabled: true,
nonce: Date.now().toString(),
},
});
Properties
| Name | Type | Description |
|---|---|---|
| enabled | boolean | Whether to enable the force-new-deployment mechanism for the service. |
| nonce? | string | A unique nonce value that signals Amazon ECS to start a new deployment. |
enabled
Type:
boolean
Whether to enable the force-new-deployment mechanism for the service.
Setting this to true enables the mechanism, but on its own it does not
force a new deployment on every cdk deploy: CloudFormation only starts a
new deployment when it detects a change in the template, and the signal for
that is the nonce value changing between deployments. If nonce is not
provided or its value stays the same across deployments, no new deployment
is forced. When set to false, the ForceNewDeployment property is rendered
with EnableForceNewDeployment: false.
To force a new deployment on every cdk deploy, provide a nonce with a
unique, time-varying value such as a timestamp, random string, or sequence
number (e.g. Date.now().toString()).
nonce?
Type:
string
(optional, default: no nonce)
A unique nonce value that signals Amazon ECS to start a new deployment.
When you change this value, it triggers a new deployment even though no other service parameters have changed. Use a stable, time-varying value like a commit hash, image digest, or version string.
If not provided and enabled is true, only EnableForceNewDeployment
is set without a nonce.
Must be between 1 and 255 characters.

.NET
Go
Java
Python
TypeScript (