Interface FargateServiceProps

All Superinterfaces:
BaseServiceOptions, software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
FargateServiceProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-25T14:21:14.615Z") @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());
 
  • Method Details

    • getTaskDefinition

      @Stability(Stable) @NotNull TaskDefinition getTaskDefinition()
      The task definition to use for tasks in the service.

      [disable-awslint:ref-via-interface]

    • getAssignPublicIp

      @Stability(Stable) @Nullable default Boolean 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

      @Stability(Stable) @Nullable default FargatePlatformVersion 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

      @Stability(Stable) @Nullable default List<ISecurityGroup> 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

      @Stability(Stable) @Nullable default SubnetSelection 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

      @Stability(Stable) static FargateServiceProps.Builder builder()
      Returns:
      a FargateServiceProps.Builder of FargateServiceProps