Class Ec2Service
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.ecs.BaseService
software.amazon.awscdk.services.ecs.Ec2Service
- All Implemented Interfaces:
IConstruct
,IDependable
,IResource
,IConnectable
,IBaseService
,IEc2Service
,IService
,ILoadBalancerTarget
,IApplicationLoadBalancerTarget
,INetworkLoadBalancerTarget
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:47.288Z")
@Stability(Stable)
public class Ec2Service
extends BaseService
implements IEc2Service
This creates a service using the EC2 launch type on an ECS cluster.
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()));
-
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.amazon.awscdk.core.IConstruct
IConstruct.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.IEc2Service
IEc2Service.Jsii$Default, IEc2Service.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.core.IResource
IResource.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
Ec2Service
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
Ec2Service
(software.amazon.jsii.JsiiObjectRef objRef) Ec2Service
(software.constructs.Construct scope, String id, Ec2ServiceProps props) Constructs a new instance of the Ec2Service class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPlacementConstraints
(@NotNull PlacementConstraint... constraints) Adds one or more placement constraints to use for tasks in the service.void
addPlacementStrategies
(@NotNull PlacementStrategy... strategies) Adds one or more placement strategies to use for tasks in the service.static IEc2Service
fromEc2ServiceArn
(software.constructs.Construct scope, String id, String ec2ServiceArn) Imports from the specified service ARN.static IBaseService
fromEc2ServiceAttributes
(software.constructs.Construct scope, String id, Ec2ServiceAttributes attrs) Imports from the specified service attributes.validate()
Validates this Ec2Service.Methods inherited from class software.amazon.awscdk.services.ecs.BaseService
associateCloudMapService, attachToApplicationTargetGroup, attachToClassicLB, attachToNetworkTargetGroup, autoScaleTaskCount, configureAwsVpcNetworking, configureAwsVpcNetworking, configureAwsVpcNetworking, configureAwsVpcNetworking, configureAwsVpcNetworkingWithSecurityGroups, configureAwsVpcNetworkingWithSecurityGroups, configureAwsVpcNetworkingWithSecurityGroups, configureAwsVpcNetworkingWithSecurityGroups, enableCloudMap, fromServiceArnWithCluster, getCloudmapService, getCloudMapService, getCluster, getConnections, getLoadBalancers, getNetworkConfiguration, getServiceArn, getServiceName, getServiceRegistries, getTaskDefinition, loadBalancerTarget, metric, metric, metricCpuUtilization, metricCpuUtilization, metricMemoryUtilization, metricMemoryUtilization, registerLoadBalancerTargets, setCloudmapService, setLoadBalancers, setNetworkConfiguration, setServiceRegistries
Methods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize
Methods inherited from class software.constructs.Construct
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.amazon.awscdk.core.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.core.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
-
Ec2Service
protected Ec2Service(software.amazon.jsii.JsiiObjectRef objRef) -
Ec2Service
protected Ec2Service(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Ec2Service
@Stability(Stable) public Ec2Service(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull Ec2ServiceProps props) Constructs a new instance of the Ec2Service class.- Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
fromEc2ServiceArn
@Stability(Stable) @NotNull public static IEc2Service fromEc2ServiceArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String ec2ServiceArn) Imports from the specified service ARN.- Parameters:
scope
- This parameter is required.id
- This parameter is required.ec2ServiceArn
- This parameter is required.
-
fromEc2ServiceAttributes
@Stability(Stable) @NotNull public static IBaseService fromEc2ServiceAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull Ec2ServiceAttributes attrs) Imports from the specified service attributes.- Parameters:
scope
- This parameter is required.id
- This parameter is required.attrs
- This parameter is required.
-
addPlacementConstraints
@Stability(Stable) public void addPlacementConstraints(@NotNull @NotNull PlacementConstraint... constraints) Adds one or more placement constraints to use for tasks in the service.For more information, see Amazon ECS Task Placement Constraints.
- Parameters:
constraints
- This parameter is required.
-
addPlacementStrategies
@Stability(Stable) public void addPlacementStrategies(@NotNull @NotNull PlacementStrategy... strategies) Adds one or more placement strategies to use for tasks in the service.For more information, see Amazon ECS Task Placement Strategies.
- Parameters:
strategies
- This parameter is required.
-
validate
Validates this Ec2Service.
-