Interface Ec2ServiceProps

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

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:47.291Z") @Stability(Stable) public interface Ec2ServiceProps extends software.amazon.jsii.JsiiSerializable, BaseServiceOptions
The properties for defining a service using the EC2 launch type.

Example:

 Cluster cluster;
 TaskDefinition taskDefinition;
 Vpc vpc;
 Ec2Service service = Ec2Service.Builder.create(this, "Service").cluster(cluster).taskDefinition(taskDefinition).build();
 LoadBalancer lb = LoadBalancer.Builder.create(this, "LB").vpc(vpc).build();
 lb.addListener(LoadBalancerListener.builder().externalPort(80).build());
 lb.addTarget(service.loadBalancerTarget(LoadBalancerTargetOptions.builder()
         .containerName("MyContainer")
         .containerPort(80)
         .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.

      This property is only used for tasks that use the awsvpc network mode.

      Default: false

    • getDaemon

      @Stability(Stable) @Nullable default Boolean getDaemon()
      Specifies whether the service will use the daemon scheduling strategy.

      If true, the service scheduler deploys exactly one task on each container instance in your cluster.

      When you are using this strategy, do not specify a desired number of tasks orany task placement strategies.

      Default: false

    • getPlacementConstraints

      @Stability(Stable) @Nullable default List<PlacementConstraint> getPlacementConstraints()
      The placement constraints to use for tasks in the service.

      For more information, see Amazon ECS Task Placement Constraints.

      Default: - No constraints.

    • getPlacementStrategies

      @Stability(Stable) @Nullable default List<PlacementStrategy> getPlacementStrategies()
      The placement strategies to use for tasks in the service.

      For more information, see Amazon ECS Task Placement Strategies.

      Default: - No strategies.

    • getSecurityGroup

      @Stability(Deprecated) @Deprecated @Nullable default ISecurityGroup getSecurityGroup()
      Deprecated.
      use securityGroups instead.
      (deprecated) The security groups to associate with the service.

      If you do not specify a security group, a new security group is created.

      This property is only used for tasks that use the awsvpc network mode.

      Default: - A new security group is created.

    • 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.

      This property is only used for tasks that use the awsvpc network mode.

      Default: - A new security group is created.

    • getVpcSubnets

      @Stability(Stable) @Nullable default SubnetSelection getVpcSubnets()
      The subnets to associate with the service.

      This property is only used for tasks that use the awsvpc network mode.

      Default: - Public subnets if `assignPublicIp` is set, otherwise the first available one of Private, Isolated, Public, in that order.

    • builder

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