Class FargateService
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ecs.BaseService
software.amazon.awscdk.services.ecs.FargateService
- All Implemented Interfaces:
IResource
,IConnectable
,IBaseService
,IFargateService
,IService
,ILoadBalancerTarget
,IApplicationLoadBalancerTarget
,INetworkLoadBalancerTarget
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-12-11T23:26:32.819Z")
@Stability(Stable)
public class FargateService
extends BaseService
implements IFargateService
This creates a service using the Fargate launch type on an ECS cluster.
Example:
import software.amazon.awscdk.services.cloudwatch.*; Cluster cluster; TaskDefinition taskDefinition; Alarm elbAlarm; FargateService service = FargateService.Builder.create(this, "Service") .cluster(cluster) .taskDefinition(taskDefinition) .deploymentAlarms(DeploymentAlarmConfig.builder() .alarmNames(List.of(elbAlarm.getAlarmName())) .behavior(AlarmBehavior.ROLLBACK_ON_ALARM) .build()) .build(); // Defining a deployment alarm after the service has been created String cpuAlarmName = "MyCpuMetricAlarm"; Alarm.Builder.create(this, "CPUAlarm") .alarmName(cpuAlarmName) .metric(service.metricCpuUtilization()) .evaluationPeriods(2) .threshold(80) .build(); service.enableDeploymentAlarms(List.of(cpuAlarmName), DeploymentAlarmOptions.builder() .behavior(AlarmBehavior.FAIL_ON_ALARM) .build());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.IApplicationLoadBalancerTarget
IApplicationLoadBalancerTarget.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.ecs.IBaseService
IBaseService.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.ecs.IFargateService
IFargateService.Jsii$Default, IFargateService.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancing.ILoadBalancerTarget
ILoadBalancerTarget.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.INetworkLoadBalancerTarget
INetworkLoadBalancerTarget.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
FargateService
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
FargateService
(software.amazon.jsii.JsiiObjectRef objRef) FargateService
(software.constructs.Construct scope, String id, FargateServiceProps props) Constructs a new instance of the FargateService class. -
Method Summary
Modifier and TypeMethodDescriptionstatic IFargateService
fromFargateServiceArn
(software.constructs.Construct scope, String id, String fargateServiceArn) Imports from the specified service ARN.static IBaseService
fromFargateServiceAttributes
(software.constructs.Construct scope, String id, FargateServiceAttributes attrs) Imports from the specified service attributes.Methods inherited from class software.amazon.awscdk.services.ecs.BaseService
addVolume, associateCloudMapService, attachToApplicationTargetGroup, attachToClassicLB, attachToNetworkTargetGroup, autoScaleTaskCount, configureAwsVpcNetworkingWithSecurityGroups, configureAwsVpcNetworkingWithSecurityGroups, configureAwsVpcNetworkingWithSecurityGroups, configureAwsVpcNetworkingWithSecurityGroups, enableCloudMap, enableDeploymentAlarms, enableDeploymentAlarms, enableServiceConnect, enableServiceConnect, fromServiceArnWithCluster, getCloudmapService, getCloudMapService, getCluster, getConnections, getDeploymentAlarms, getLoadBalancers, getNetworkConfiguration, getServiceArn, getServiceName, getServiceRegistries, getTaskDefinition, loadBalancerTarget, metric, metric, metricCpuUtilization, metricCpuUtilization, metricMemoryUtilization, metricMemoryUtilization, registerLoadBalancerTargets, setCloudmapService, setDeploymentAlarms, setLoadBalancers, setNetworkConfiguration, setServiceRegistries
Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource
Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
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.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.awscdk.services.ecs.IService
getServiceArn, getServiceName
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
FargateService
protected FargateService(software.amazon.jsii.JsiiObjectRef objRef) -
FargateService
protected FargateService(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
FargateService
@Stability(Stable) public FargateService(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull FargateServiceProps props) Constructs a new instance of the FargateService class.- Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
fromFargateServiceArn
@Stability(Stable) @NotNull public static IFargateService fromFargateServiceArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String fargateServiceArn) Imports from the specified service ARN.- Parameters:
scope
- This parameter is required.id
- This parameter is required.fargateServiceArn
- This parameter is required.
-
fromFargateServiceAttributes
@Stability(Stable) @NotNull public static IBaseService fromFargateServiceAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull FargateServiceAttributes attrs) Imports from the specified service attributes.- Parameters:
scope
- This parameter is required.id
- This parameter is required.attrs
- This parameter is required.
-