Class CfnService
- All Implemented Interfaces:
IInspectable
,ITaggable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
AWS::ECS::Service
resource creates an Amazon Elastic Container Service (Amazon ECS) service that runs and maintains the requested number of tasks and associated load balancers.
The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect
ServiceConnectConfiguration
property the is configured. This is because AWS CloudFormation creates the replacement service first, but eachServiceConnectService
must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.ecs.*; CfnService cfnService = CfnService.Builder.create(this, "MyCfnService") .availabilityZoneRebalancing("availabilityZoneRebalancing") .capacityProviderStrategy(List.of(CapacityProviderStrategyItemProperty.builder() .base(123) .capacityProvider("capacityProvider") .weight(123) .build())) .cluster("cluster") .deploymentConfiguration(DeploymentConfigurationProperty.builder() .alarms(DeploymentAlarmsProperty.builder() .alarmNames(List.of("alarmNames")) .enable(false) .rollback(false) .build()) .deploymentCircuitBreaker(DeploymentCircuitBreakerProperty.builder() .enable(false) .rollback(false) .build()) .maximumPercent(123) .minimumHealthyPercent(123) .build()) .deploymentController(DeploymentControllerProperty.builder() .type("type") .build()) .desiredCount(123) .enableEcsManagedTags(false) .enableExecuteCommand(false) .healthCheckGracePeriodSeconds(123) .launchType("launchType") .loadBalancers(List.of(LoadBalancerProperty.builder() .containerName("containerName") .containerPort(123) .loadBalancerName("loadBalancerName") .targetGroupArn("targetGroupArn") .build())) .networkConfiguration(NetworkConfigurationProperty.builder() .awsvpcConfiguration(AwsVpcConfigurationProperty.builder() .assignPublicIp("assignPublicIp") .securityGroups(List.of("securityGroups")) .subnets(List.of("subnets")) .build()) .build()) .placementConstraints(List.of(PlacementConstraintProperty.builder() .type("type") // the properties below are optional .expression("expression") .build())) .placementStrategies(List.of(PlacementStrategyProperty.builder() .type("type") // the properties below are optional .field("field") .build())) .platformVersion("platformVersion") .propagateTags("propagateTags") .role("role") .schedulingStrategy("schedulingStrategy") .serviceConnectConfiguration(ServiceConnectConfigurationProperty.builder() .enabled(false) // the properties below are optional .logConfiguration(LogConfigurationProperty.builder() .logDriver("logDriver") .options(Map.of( "optionsKey", "options")) .secretOptions(List.of(SecretProperty.builder() .name("name") .valueFrom("valueFrom") .build())) .build()) .namespace("namespace") .services(List.of(ServiceConnectServiceProperty.builder() .portName("portName") // the properties below are optional .clientAliases(List.of(ServiceConnectClientAliasProperty.builder() .port(123) // the properties below are optional .dnsName("dnsName") .build())) .discoveryName("discoveryName") .ingressPortOverride(123) .timeout(TimeoutConfigurationProperty.builder() .idleTimeoutSeconds(123) .perRequestTimeoutSeconds(123) .build()) .tls(ServiceConnectTlsConfigurationProperty.builder() .issuerCertificateAuthority(ServiceConnectTlsCertificateAuthorityProperty.builder() .awsPcaAuthorityArn("awsPcaAuthorityArn") .build()) // the properties below are optional .kmsKey("kmsKey") .roleArn("roleArn") .build()) .build())) .build()) .serviceName("serviceName") .serviceRegistries(List.of(ServiceRegistryProperty.builder() .containerName("containerName") .containerPort(123) .port(123) .registryArn("registryArn") .build())) .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .taskDefinition("taskDefinition") .volumeConfigurations(List.of(ServiceVolumeConfigurationProperty.builder() .name("name") // the properties below are optional .managedEbsVolume(ServiceManagedEBSVolumeConfigurationProperty.builder() .roleArn("roleArn") // the properties below are optional .encrypted(false) .filesystemType("filesystemType") .iops(123) .kmsKeyId("kmsKeyId") .sizeInGiB(123) .snapshotId("snapshotId") .tagSpecifications(List.of(EBSTagSpecificationProperty.builder() .resourceType("resourceType") // the properties below are optional .propagateTags("propagateTags") .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .build())) .throughput(123) .volumeType("volumeType") .build()) .build())) .vpcLatticeConfigurations(List.of(VpcLatticeConfigurationProperty.builder() .portName("portName") .roleArn("roleArn") .targetGroupArn("targetGroupArn") .build())) .build();
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
An object representing the networking details for a task or service.static final class
A fluent builder forCfnService
.static interface
The details of a capacity provider strategy.static interface
One of the methods which provide a way for you to quickly identify when a deployment has failed, and then to optionally roll back the failure to the last working deployment.static interface
static interface
Optional deployment parameters that control how many tasks run during a deployment and the ordering of stopping and starting tasks.static interface
The deployment controller to use for the service.static interface
The tag specifications of an Amazon EBS volume.static interface
TheLoadBalancer
property specifies details on a load balancer that is used with a service.static interface
The log configuration for the container.static interface
The network configuration for a task or service.static interface
An object representing a constraint on task placement.static interface
The task placement strategy for a task or service.static interface
An object representing the secret to expose to your container.static interface
Each alias ("endpoint") is a fully-qualified name and port number that other tasks ("clients") can use to connect to this service.static interface
The Service Connect configuration of your Amazon ECS service.static interface
The Service Connect service object configuration.static interface
The certificate root authority that secures your service.static interface
The key that encrypts and decrypts your resources for Service Connect TLS.static interface
The configuration for the Amazon EBS volume that Amazon ECS creates and manages on your behalf.static interface
The details for the service registry.static interface
The configuration for a volume specified in the task definition as a volume that is configured at launch time.static interface
An object that represents the timeout configurations for Service Connect.static interface
The VPC Lattice configuration for your service that holds the information for the target group(s) Amazon ECS tasks will be registered to.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnService
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnService
(software.amazon.jsii.JsiiObjectRef objRef) CfnService
(software.constructs.Construct scope, String id) CfnService
(software.constructs.Construct scope, String id, CfnServiceProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe name of the Amazon ECS service, such assample-webapp
.Not currently supported in AWS CloudFormation .The capacity provider strategy to use for the service.The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on.Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.The deployment controller to use for the service.The number of instantiations of the specified task definition to place and keep running in your service.Specifies whether to turn on Amazon ECS managed tags for the tasks within the service.Determines whether the execute command functionality is turned on for the service.The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a task has first started.The launch type on which to run your service.A list of load balancer objects to associate with the service.The network configuration for the service.An array of placement constraint objects to use for tasks in your service.The placement strategy objects to use for tasks in your service.The platform version that your tasks in the service are running on.Specifies whether to propagate the tags from the task definition to the task.getRole()
The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf.The scheduling strategy to use for the service.The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace.The name of your service.The details of the service discovery registry to associate with this service.getTags()
Tag Manager which manages the tags for this resource.The metadata that you apply to the service to help you categorize and organize them.Thefamily
andrevision
(family:revision
) or full ARN of the task definition to run in your service.The configuration for a volume specified in the task definition as a volume that is configured at launch time.The VPC Lattice configuration for the service being created.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
void
setCapacityProviderStrategy
(List<Object> value) The capacity provider strategy to use for the service.void
The capacity provider strategy to use for the service.void
setCluster
(String value) The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on.void
Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.void
Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.void
The deployment controller to use for the service.void
The deployment controller to use for the service.void
setDesiredCount
(Number value) The number of instantiations of the specified task definition to place and keep running in your service.void
setEnableEcsManagedTags
(Boolean value) Specifies whether to turn on Amazon ECS managed tags for the tasks within the service.void
Specifies whether to turn on Amazon ECS managed tags for the tasks within the service.void
setEnableExecuteCommand
(Boolean value) Determines whether the execute command functionality is turned on for the service.void
Determines whether the execute command functionality is turned on for the service.void
The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a task has first started.void
setLaunchType
(String value) The launch type on which to run your service.void
setLoadBalancers
(List<Object> value) A list of load balancer objects to associate with the service.void
setLoadBalancers
(IResolvable value) A list of load balancer objects to associate with the service.void
The network configuration for the service.void
The network configuration for the service.void
setPlacementConstraints
(List<Object> value) An array of placement constraint objects to use for tasks in your service.void
An array of placement constraint objects to use for tasks in your service.void
setPlacementStrategies
(List<Object> value) The placement strategy objects to use for tasks in your service.void
The placement strategy objects to use for tasks in your service.void
setPlatformVersion
(String value) The platform version that your tasks in the service are running on.void
setPropagateTags
(String value) Specifies whether to propagate the tags from the task definition to the task.void
The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf.void
setSchedulingStrategy
(String value) The scheduling strategy to use for the service.void
The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace.void
The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace.void
setServiceName
(String value) The name of your service.void
setServiceRegistries
(List<Object> value) The details of the service discovery registry to associate with this service.void
setServiceRegistries
(IResolvable value) The details of the service discovery registry to associate with this service.void
setTagsRaw
(List<CfnTag> value) The metadata that you apply to the service to help you categorize and organize them.void
setTaskDefinition
(String value) Thefamily
andrevision
(family:revision
) or full ARN of the task definition to run in your service.void
setVolumeConfigurations
(List<Object> value) The configuration for a volume specified in the task definition as a volume that is configured at launch time.void
The configuration for a volume specified in the task definition as a volume that is configured at launch time.void
setVpcLatticeConfigurations
(List<Object> value) The VPC Lattice configuration for the service being created.void
The VPC Lattice configuration for the service being created.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnService
protected CfnService(software.amazon.jsii.JsiiObjectRef objRef) -
CfnService
protected CfnService(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnService
@Stability(Stable) public CfnService(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnServiceProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties.
-
CfnService
@Stability(Stable) public CfnService(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrName
The name of the Amazon ECS service, such assample-webapp
. -
getAttrServiceArn
Not currently supported in AWS CloudFormation . -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
Tag Manager which manages the tags for this resource. -
getAvailabilityZoneRebalancing
-
setAvailabilityZoneRebalancing
-
getCapacityProviderStrategy
The capacity provider strategy to use for the service. -
setCapacityProviderStrategy
The capacity provider strategy to use for the service. -
setCapacityProviderStrategy
The capacity provider strategy to use for the service. -
getCluster
The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on. -
setCluster
The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on. -
getDeploymentConfiguration
Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks. -
setDeploymentConfiguration
Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks. -
setDeploymentConfiguration
@Stability(Stable) public void setDeploymentConfiguration(@Nullable CfnService.DeploymentConfigurationProperty value) Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks. -
getDeploymentController
The deployment controller to use for the service. -
setDeploymentController
The deployment controller to use for the service. -
setDeploymentController
@Stability(Stable) public void setDeploymentController(@Nullable CfnService.DeploymentControllerProperty value) The deployment controller to use for the service. -
getDesiredCount
The number of instantiations of the specified task definition to place and keep running in your service. -
setDesiredCount
The number of instantiations of the specified task definition to place and keep running in your service. -
getEnableEcsManagedTags
Specifies whether to turn on Amazon ECS managed tags for the tasks within the service. -
setEnableEcsManagedTags
Specifies whether to turn on Amazon ECS managed tags for the tasks within the service. -
setEnableEcsManagedTags
Specifies whether to turn on Amazon ECS managed tags for the tasks within the service. -
getEnableExecuteCommand
Determines whether the execute command functionality is turned on for the service. -
setEnableExecuteCommand
Determines whether the execute command functionality is turned on for the service. -
setEnableExecuteCommand
Determines whether the execute command functionality is turned on for the service. -
getHealthCheckGracePeriodSeconds
The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a task has first started. -
setHealthCheckGracePeriodSeconds
The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a task has first started. -
getLaunchType
The launch type on which to run your service. -
setLaunchType
The launch type on which to run your service. -
getLoadBalancers
A list of load balancer objects to associate with the service. -
setLoadBalancers
A list of load balancer objects to associate with the service. -
setLoadBalancers
A list of load balancer objects to associate with the service. -
getNetworkConfiguration
The network configuration for the service. -
setNetworkConfiguration
The network configuration for the service. -
setNetworkConfiguration
@Stability(Stable) public void setNetworkConfiguration(@Nullable CfnService.NetworkConfigurationProperty value) The network configuration for the service. -
getPlacementConstraints
An array of placement constraint objects to use for tasks in your service. -
setPlacementConstraints
An array of placement constraint objects to use for tasks in your service. -
setPlacementConstraints
An array of placement constraint objects to use for tasks in your service. -
getPlacementStrategies
The placement strategy objects to use for tasks in your service. -
setPlacementStrategies
The placement strategy objects to use for tasks in your service. -
setPlacementStrategies
The placement strategy objects to use for tasks in your service. -
getPlatformVersion
The platform version that your tasks in the service are running on. -
setPlatformVersion
The platform version that your tasks in the service are running on. -
getPropagateTags
Specifies whether to propagate the tags from the task definition to the task. -
setPropagateTags
Specifies whether to propagate the tags from the task definition to the task. -
getRole
The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. -
setRole
The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. -
getSchedulingStrategy
The scheduling strategy to use for the service.For more information, see Services .
-
setSchedulingStrategy
The scheduling strategy to use for the service.For more information, see Services .
-
getServiceConnectConfiguration
The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace. -
setServiceConnectConfiguration
The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace. -
setServiceConnectConfiguration
@Stability(Stable) public void setServiceConnectConfiguration(@Nullable CfnService.ServiceConnectConfigurationProperty value) The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace. -
getServiceName
The name of your service. -
setServiceName
The name of your service. -
getServiceRegistries
The details of the service discovery registry to associate with this service.For more information, see Service discovery .
-
setServiceRegistries
The details of the service discovery registry to associate with this service.For more information, see Service discovery .
-
setServiceRegistries
The details of the service discovery registry to associate with this service.For more information, see Service discovery .
-
getTagsRaw
The metadata that you apply to the service to help you categorize and organize them. -
setTagsRaw
The metadata that you apply to the service to help you categorize and organize them. -
getTaskDefinition
Thefamily
andrevision
(family:revision
) or full ARN of the task definition to run in your service. -
setTaskDefinition
Thefamily
andrevision
(family:revision
) or full ARN of the task definition to run in your service. -
getVolumeConfigurations
The configuration for a volume specified in the task definition as a volume that is configured at launch time. -
setVolumeConfigurations
The configuration for a volume specified in the task definition as a volume that is configured at launch time. -
setVolumeConfigurations
The configuration for a volume specified in the task definition as a volume that is configured at launch time. -
getVpcLatticeConfigurations
The VPC Lattice configuration for the service being created. -
setVpcLatticeConfigurations
The VPC Lattice configuration for the service being created. -
setVpcLatticeConfigurations
The VPC Lattice configuration for the service being created.
-