Interface FargateServiceProps
- All Superinterfaces:
BaseServiceOptions,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
FargateServiceProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-11-06T23:25:09.389Z")
@Stability(Stable)
public interface FargateServiceProps
extends software.amazon.jsii.JsiiSerializable, BaseServiceOptions
The properties for defining a service using the Fargate launch type.
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 ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forFargateServicePropsstatic final classAn implementation forFargateServiceProps -
Method Summary
Modifier and TypeMethodDescriptionstatic FargateServiceProps.Builderbuilder()default BooleanSpecifies whether the task's elastic network interface receives a public IP address.default FargatePlatformVersionThe platform version on which to run your service.default List<ISecurityGroup>The security groups to associate with the service.The task definition to use for tasks in the service.default SubnetSelectionThe subnets to associate with the service.Methods inherited from interface software.amazon.awscdk.services.ecs.BaseServiceOptions
getCapacityProviderStrategies, getCircuitBreaker, getCloudMapOptions, getCluster, getDeploymentAlarms, getDeploymentController, getDesiredCount, getEnableECSManagedTags, getEnableExecuteCommand, getHealthCheckGracePeriod, getMaxHealthyPercent, getMinHealthyPercent, getPropagateTags, getServiceConnectConfiguration, getServiceName, getTaskDefinitionRevision, getVolumeConfigurationsMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getTaskDefinition
The task definition to use for tasks in the service.[disable-awslint:ref-via-interface]
-
getAssignPublicIp
Specifies whether the task's elastic network interface receives a public IP address.If true, each task will receive a public IP address.
Default: false
-
getPlatformVersion
The platform version on which to run your service.If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.
Default: Latest
-
getSecurityGroups
The security groups to associate with the service.If you do not specify a security group, a new security group is created.
Default: - A new security group is created.
-
getVpcSubnets
The subnets to associate with the service.Default: - Public subnets if `assignPublicIp` is set, otherwise the first available one of Private, Isolated, Public, in that order.
-
builder
- Returns:
- a
FargateServiceProps.BuilderofFargateServiceProps
-