Class: AWSCDK::ECS::EC2Service
- Inherits:
-
BaseService
- Object
- BaseService
- AWSCDK::ECS::EC2Service
- Includes:
- IEC2Service
- Defined in:
- ecs/ec2_service.rb
Overview
This creates a service using the EC2 launch type on an ECS cluster.
Class Method Summary collapse
-
.from_ec2_service_arn(scope, id, ec2_service_arn) ⇒ AWSCDK::ECS::IEC2Service
Imports from the specified service ARN.
-
.from_ec2_service_attributes(scope, id, attrs) ⇒ AWSCDK::ECS::IBaseService
Imports from the specified service attributes.
- .jsii_overridable_methods ⇒ Object
-
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
Instance Method Summary collapse
-
#add_lifecycle_hook(target) ⇒ void
Add a deployment lifecycle hook target.
-
#add_placement_constraints(*constraints) ⇒ void
Adds one or more placement constraints to use for tasks in the service.
-
#add_placement_strategies(*new_strategies) ⇒ void
Adds one or more placement strategies to use for tasks in the service.
-
#add_volume(volume) ⇒ void
Adds a volume to the Service.
-
#apply_cross_stack_reference_strength(strength) ⇒ void
Override the cross-stack reference strength for this resource.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#associate_cloud_map_service(options) ⇒ void
Associates this service with a CloudMap service.
-
#attach_to_application_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps
This method is called to attach this service to an Application Load Balancer.
-
#attach_to_classic_lb(load_balancer) ⇒ void
Registers the service as a target of a Classic Load Balancer (CLB).
-
#attach_to_network_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps
This method is called to attach this service to a Network Load Balancer.
-
#auto_scale_task_count(props) ⇒ AWSCDK::ECS::ScalableTaskCount
An attribute representing the minimum and maximum task count for an AutoScalingGroup.
-
#cloud_map_service ⇒ AWSCDK::ServiceDiscovery::IService?
The CloudMap service created for this service, if any.
-
#cloudmap_service ⇒ AWSCDK::ServiceDiscovery::Service?
The details of the AWS Cloud Map service.
- #cloudmap_service=(value) ⇒ Object
-
#cluster ⇒ AWSCDK::ECS::ICluster
The cluster that hosts the service.
-
#configure_aws_vpc_networking_with_security_groups(vpc, assign_public_ip = nil, vpc_subnets = nil, security_groups = nil) ⇒ void
This method is called to create a networkConfiguration.
-
#connections ⇒ AWSCDK::EC2::Connections
The security groups which manage the allowed network traffic for the service.
- #deployment_alarms ⇒ AWSCDK::ECS::CfnService::DeploymentAlarmsProperty?
- #deployment_alarms=(value) ⇒ Object
-
#enable_cloud_map(options) ⇒ AWSCDK::ServiceDiscovery::Service
Enable CloudMap service discovery for the service.
-
#enable_deployment_alarms(alarm_names, options = nil) ⇒ void
Enable Deployment Alarms which take advantage of arbitrary alarms and configure them after service initialization.
-
#enable_service_connect(config = nil) ⇒ void
Enable Service Connect on this service.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#force_new_deployment(nonce = nil) ⇒ void
Forces a new deployment of the service.
- #generate_physical_name ⇒ String
-
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g.
bucket.bucketArn). -
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g.
bucket.bucketName). -
#initialize(scope, id, props) ⇒ EC2Service
constructor
Constructs a new instance of the Ec2Service class.
-
#is_using_ecs_deployment_controller ⇒ Boolean
Checks if the service is using the ECS deployment controller.
-
#load_balancer_target(options) ⇒ AWSCDK::ECS::IECSLoadBalancerTarget
Return a load balancing target for a specific container and port.
-
#load_balancers ⇒ Array<AWSCDK::ECS::CfnService::LoadBalancerProperty>
A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
- #load_balancers=(value) ⇒ Object
-
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
This method returns the specified CloudWatch metric name for this service.
-
#metric_cpu_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric
This method returns the CloudWatch metric for this service's CPU utilization.
-
#metric_memory_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric
This method returns the CloudWatch metric for this service's memory utilization.
- #network_configuration ⇒ AWSCDK::ECS::CfnService::NetworkConfigurationProperty?
- #network_configuration=(value) ⇒ Object
-
#node ⇒ Constructs::Node
The tree node.
-
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
-
#register_load_balancer_targets(*targets) ⇒ void
Use this function to create all load balancer targets to be registered in this service, add them to target groups, and attach target groups to listeners accordingly.
-
#service_arn ⇒ String
The Amazon Resource Name (ARN) of the service.
-
#service_name ⇒ String
The name of the service.
-
#service_ref ⇒ AWSCDK::Interfaces::AWSECS::ServiceReference
A reference to this service.
-
#service_registries ⇒ Array<AWSCDK::ECS::CfnService::ServiceRegistryProperty>
The details of the service discovery registries to assign to this service.
- #service_registries=(value) ⇒ Object
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#task_definition ⇒ AWSCDK::ECS::TaskDefinition
The task definition to use for tasks in the service.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props) ⇒ EC2Service
Constructs a new instance of the Ec2Service class.
14 15 16 17 18 19 20 |
# File 'ecs/ec2_service.rb', line 14 def initialize(scope, id, props) props = props.is_a?(Hash) ? ::AWSCDK::ECS::EC2ServiceProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkVjMlNlcnZpY2VQcm9wcyJ9")), "props") Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props) end |
Class Method Details
.from_ec2_service_arn(scope, id, ec2_service_arn) ⇒ AWSCDK::ECS::IEC2Service
Imports from the specified service ARN.
76 77 78 79 80 81 |
# File 'ecs/ec2_service.rb', line 76 def self.from_ec2_service_arn(scope, id, ec2_service_arn) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(ec2_service_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ec2ServiceArn") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.Ec2Service", "fromEc2ServiceArn", [scope, id, ec2_service_arn]) end |
.from_ec2_service_attributes(scope, id, attrs) ⇒ AWSCDK::ECS::IBaseService
Imports from the specified service attributes.
89 90 91 92 93 94 95 |
# File 'ecs/ec2_service.rb', line 89 def self.from_ec2_service_attributes(scope, id, attrs) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") attrs = attrs.is_a?(Hash) ? ::AWSCDK::ECS::EC2ServiceAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkVjMlNlcnZpY2VBdHRyaWJ1dGVzIn0=")), "attrs") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.Ec2Service", "fromEc2ServiceAttributes", [scope, id, attrs]) end |
.jsii_overridable_methods ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'ecs/ec2_service.rb', line 22 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :physical_name => { kind: :property, name: "physicalName", is_optional: false }, :stack => { kind: :property, name: "stack", is_optional: false }, :cluster => { kind: :property, name: "cluster", is_optional: false }, :connections => { kind: :property, name: "connections", is_optional: false }, :service_arn => { kind: :property, name: "serviceArn", is_optional: false }, :service_name => { kind: :property, name: "serviceName", is_optional: false }, :service_ref => { kind: :property, name: "serviceRef", is_optional: false }, :task_definition => { kind: :property, name: "taskDefinition", is_optional: false }, :cloud_map_service => { kind: :property, name: "cloudMapService", is_optional: true }, :load_balancers => { kind: :property, name: "loadBalancers", is_optional: false }, :service_registries => { kind: :property, name: "serviceRegistries", is_optional: false }, :cloudmap_service => { kind: :property, name: "cloudmapService", is_optional: true }, :deployment_alarms => { kind: :property, name: "deploymentAlarms", is_optional: true }, :network_configuration => { kind: :property, name: "networkConfiguration", is_optional: true }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false }, :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false }, :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false }, :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false }, :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false }, :add_lifecycle_hook => { kind: :method, name: "addLifecycleHook", is_optional: false }, :add_volume => { kind: :method, name: "addVolume", is_optional: false }, :associate_cloud_map_service => { kind: :method, name: "associateCloudMapService", is_optional: false }, :attach_to_application_target_group => { kind: :method, name: "attachToApplicationTargetGroup", is_optional: false }, :attach_to_classic_lb => { kind: :method, name: "attachToClassicLB", is_optional: false }, :attach_to_network_target_group => { kind: :method, name: "attachToNetworkTargetGroup", is_optional: false }, :auto_scale_task_count => { kind: :method, name: "autoScaleTaskCount", is_optional: false }, :configure_aws_vpc_networking_with_security_groups => { kind: :method, name: "configureAwsVpcNetworkingWithSecurityGroups", is_optional: false }, :enable_cloud_map => { kind: :method, name: "enableCloudMap", is_optional: false }, :enable_deployment_alarms => { kind: :method, name: "enableDeploymentAlarms", is_optional: false }, :enable_service_connect => { kind: :method, name: "enableServiceConnect", is_optional: false }, :force_new_deployment => { kind: :method, name: "forceNewDeployment", is_optional: false }, :is_using_ecs_deployment_controller => { kind: :method, name: "isUsingECSDeploymentController", is_optional: false }, :load_balancer_target => { kind: :method, name: "loadBalancerTarget", is_optional: false }, :metric => { kind: :method, name: "metric", is_optional: false }, :metric_cpu_utilization => { kind: :method, name: "metricCpuUtilization", is_optional: false }, :metric_memory_utilization => { kind: :method, name: "metricMemoryUtilization", is_optional: false }, :register_load_balancer_targets => { kind: :method, name: "registerLoadBalancerTargets", is_optional: false }, :add_placement_constraints => { kind: :method, name: "addPlacementConstraints", is_optional: false }, :add_placement_strategies => { kind: :method, name: "addPlacementStrategies", is_optional: false }, } end |
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
254 255 256 |
# File 'ecs/ec2_service.rb', line 254 def self.PROPERTY_INJECTION_ID() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ecs.Ec2Service", "PROPERTY_INJECTION_ID") end |
Instance Method Details
#add_lifecycle_hook(target) ⇒ void
This method returns an undefined value.
Add a deployment lifecycle hook target.
352 353 354 355 |
# File 'ecs/ec2_service.rb', line 352 def add_lifecycle_hook(target) Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLklEZXBsb3ltZW50TGlmZWN5Y2xlSG9va1RhcmdldCJ9")), "target") jsii_call_method("addLifecycleHook", [target]) end |
#add_placement_constraints(*constraints) ⇒ void
This method returns an undefined value.
Adds one or more placement constraints to use for tasks in the service.
For more information, see Amazon ECS Task Placement Constraints.
603 604 605 606 607 608 |
# File 'ecs/ec2_service.rb', line 603 def add_placement_constraints(*constraints) constraints.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlBsYWNlbWVudENvbnN0cmFpbnQifQ==")), "constraints[#{index}]") end jsii_call_method("addPlacementConstraints", [*constraints]) end |
#add_placement_strategies(*new_strategies) ⇒ void
This method returns an undefined value.
Adds one or more placement strategies to use for tasks in the service.
For more information, see Amazon ECS Task Placement Strategies.
617 618 619 620 621 622 |
# File 'ecs/ec2_service.rb', line 617 def add_placement_strategies(*new_strategies) new_strategies.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlBsYWNlbWVudFN0cmF0ZWd5In0=")), "newStrategies[#{index}]") end jsii_call_method("addPlacementStrategies", [*new_strategies]) end |
#add_volume(volume) ⇒ void
This method returns an undefined value.
Adds a volume to the Service.
361 362 363 364 |
# File 'ecs/ec2_service.rb', line 361 def add_volume(volume) Jsii::Type.check_type(volume, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlNlcnZpY2VNYW5hZ2VkVm9sdW1lIn0=")), "volume") jsii_call_method("addVolume", [volume]) end |
#apply_cross_stack_reference_strength(strength) ⇒ void
This method returns an undefined value.
Override the cross-stack reference strength for this resource.
When set, any cross-stack reference to this resource will use the specified
mechanism instead of the global default determined by the
@aws-cdk/core:defaultCrossStackReferences context key. This is useful for
selectively weakening specific references to avoid the "deadly embrace" problem
without changing the app-wide default.
291 292 293 294 |
# File 'ecs/ec2_service.rb', line 291 def apply_cross_stack_reference_strength(strength) Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength") jsii_call_method("applyCrossStackReferenceStrength", [strength]) end |
#apply_removal_policy(policy) ⇒ void
This method returns an undefined value.
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
308 309 310 311 |
# File 'ecs/ec2_service.rb', line 308 def apply_removal_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") jsii_call_method("applyRemovalPolicy", [policy]) end |
#associate_cloud_map_service(options) ⇒ void
This method returns an undefined value.
Associates this service with a CloudMap service.
370 371 372 373 374 |
# File 'ecs/ec2_service.rb', line 370 def associate_cloud_map_service() = .is_a?(Hash) ? ::AWSCDK::ECS::AssociateCloudMapServiceOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkFzc29jaWF0ZUNsb3VkTWFwU2VydmljZU9wdGlvbnMifQ==")), "options") jsii_call_method("associateCloudMapService", []) end |
#attach_to_application_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps
This method is called to attach this service to an Application Load Balancer.
Don't call this function directly. Instead, call listener.addTargets()
to add this service to a load balancer.
383 384 385 386 |
# File 'ecs/ec2_service.rb', line 383 def attach_to_application_target_group(target_group) Jsii::Type.check_type(target_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JQXBwbGljYXRpb25UYXJnZXRHcm91cCJ9")), "targetGroup") jsii_call_method("attachToApplicationTargetGroup", [target_group]) end |
#attach_to_classic_lb(load_balancer) ⇒ void
This method returns an undefined value.
Registers the service as a target of a Classic Load Balancer (CLB).
Don't call this. Call loadBalancer.addTarget() instead.
394 395 396 397 |
# File 'ecs/ec2_service.rb', line 394 def attach_to_classic_lb(load_balancer) Jsii::Type.check_type(load_balancer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmcuTG9hZEJhbGFuY2VyIn0=")), "loadBalancer") jsii_call_method("attachToClassicLB", [load_balancer]) end |
#attach_to_network_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps
This method is called to attach this service to a Network Load Balancer.
Don't call this function directly. Instead, call listener.addTargets()
to add this service to a load balancer.
406 407 408 409 |
# File 'ecs/ec2_service.rb', line 406 def attach_to_network_target_group(target_group) Jsii::Type.check_type(target_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JTmV0d29ya1RhcmdldEdyb3VwIn0=")), "targetGroup") jsii_call_method("attachToNetworkTargetGroup", [target_group]) end |
#auto_scale_task_count(props) ⇒ AWSCDK::ECS::ScalableTaskCount
An attribute representing the minimum and maximum task count for an AutoScalingGroup.
415 416 417 418 419 |
# File 'ecs/ec2_service.rb', line 415 def auto_scale_task_count(props) props = props.is_a?(Hash) ? ::AWSCDK::ApplicationAutoScaling::EnableScalingProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5FbmFibGVTY2FsaW5nUHJvcHMifQ==")), "props") jsii_call_method("autoScaleTaskCount", [props]) end |
#cloud_map_service ⇒ AWSCDK::ServiceDiscovery::IService?
The CloudMap service created for this service, if any.
185 186 187 |
# File 'ecs/ec2_service.rb', line 185 def cloud_map_service() jsii_get_property("cloudMapService") end |
#cloudmap_service ⇒ AWSCDK::ServiceDiscovery::Service?
The details of the AWS Cloud Map service.
220 221 222 |
# File 'ecs/ec2_service.rb', line 220 def cloudmap_service() jsii_get_property("cloudmapService") end |
#cloudmap_service=(value) ⇒ Object
224 225 226 227 |
# File 'ecs/ec2_service.rb', line 224 def cloudmap_service=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VydmljZWRpc2NvdmVyeS5TZXJ2aWNlIn0=")), "cloudmapService") unless value.nil? jsii_set_property("cloudmapService", value) end |
#cluster ⇒ AWSCDK::ECS::ICluster
The cluster that hosts the service.
143 144 145 |
# File 'ecs/ec2_service.rb', line 143 def cluster() jsii_get_property("cluster") end |
#configure_aws_vpc_networking_with_security_groups(vpc, assign_public_ip = nil, vpc_subnets = nil, security_groups = nil) ⇒ void
This method returns an undefined value.
This method is called to create a networkConfiguration.
428 429 430 431 432 433 434 435 |
# File 'ecs/ec2_service.rb', line 428 def configure_aws_vpc_networking_with_security_groups(vpc, assign_public_ip = nil, vpc_subnets = nil, security_groups = nil) Jsii::Type.check_type(vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") Jsii::Type.check_type(assign_public_ip, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "assignPublicIp") unless assign_public_ip.nil? vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets Jsii::Type.check_type(vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless vpc_subnets.nil? Jsii::Type.check_type(security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless security_groups.nil? jsii_call_method("configureAwsVpcNetworkingWithSecurityGroups", [vpc, assign_public_ip, vpc_subnets, security_groups]) end |
#connections ⇒ AWSCDK::EC2::Connections
The security groups which manage the allowed network traffic for the service.
150 151 152 |
# File 'ecs/ec2_service.rb', line 150 def connections() jsii_get_property("connections") end |
#deployment_alarms ⇒ AWSCDK::ECS::CfnService::DeploymentAlarmsProperty?
230 231 232 |
# File 'ecs/ec2_service.rb', line 230 def deployment_alarms() jsii_get_property("deploymentAlarms") end |
#deployment_alarms=(value) ⇒ Object
234 235 236 237 238 |
# File 'ecs/ec2_service.rb', line 234 def deployment_alarms=(value) value = value.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::DeploymentAlarmsProperty.new(**value.transform_keys(&:to_sym)) : value Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNmblNlcnZpY2UuRGVwbG95bWVudEFsYXJtc1Byb3BlcnR5In0=")), "deploymentAlarms") unless value.nil? jsii_set_property("deploymentAlarms", value) end |
#enable_cloud_map(options) ⇒ AWSCDK::ServiceDiscovery::Service
Enable CloudMap service discovery for the service.
441 442 443 444 445 |
# File 'ecs/ec2_service.rb', line 441 def enable_cloud_map() = .is_a?(Hash) ? ::AWSCDK::ECS::CloudMapOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNsb3VkTWFwT3B0aW9ucyJ9")), "options") jsii_call_method("enableCloudMap", []) end |
#enable_deployment_alarms(alarm_names, options = nil) ⇒ void
This method returns an undefined value.
Enable Deployment Alarms which take advantage of arbitrary alarms and configure them after service initialization.
If you have already enabled deployment alarms, this function can be used to tell ECS about additional alarms that should interrupt a deployment.
New alarms specified in subsequent calls of this function will be appended to the existing list of alarms.
The same Alarm Behavior must be used on all deployment alarms. If you specify different AlarmBehavior values in multiple calls to this function, or the Alarm Behavior used here doesn't match the one used in the service constructor, an error will be thrown.
If the alarm's metric references the service, you cannot pass Alarm.alarmName here. That will cause a circular
dependency between the service and its deployment alarm. See this package's README for options to alarm on service
metrics, and avoid this circular dependency.
465 466 467 468 469 470 |
# File 'ecs/ec2_service.rb', line 465 def enable_deployment_alarms(alarm_names, = nil) Jsii::Type.check_type(alarm_names, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "alarmNames") = .is_a?(Hash) ? ::AWSCDK::ECS::DeploymentAlarmOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkRlcGxveW1lbnRBbGFybU9wdGlvbnMifQ==")), "options") unless .nil? jsii_call_method("enableDeploymentAlarms", [alarm_names, ]) end |
#enable_service_connect(config = nil) ⇒ void
This method returns an undefined value.
Enable Service Connect on this service.
476 477 478 479 480 |
# File 'ecs/ec2_service.rb', line 476 def enable_service_connect(config = nil) config = config.is_a?(Hash) ? ::AWSCDK::ECS::ServiceConnectProps.new(**config.transform_keys(&:to_sym)) : config Jsii::Type.check_type(config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlNlcnZpY2VDb25uZWN0UHJvcHMifQ==")), "config") unless config.nil? jsii_call_method("enableServiceConnect", [config]) end |
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
115 116 117 |
# File 'ecs/ec2_service.rb', line 115 def env() jsii_get_property("env") end |
#force_new_deployment(nonce = nil) ⇒ void
This method returns an undefined value.
Forces a new deployment of the service.
This can be used to trigger a deployment without changing the task definition or desired count. ECS will start a new deployment even if there are no changes to the service configuration.
Important: When called without a nonce, a timestamp is generated automatically, which means
every cdk synth produces a different template and every cdk deploy triggers a new deployment
regardless of whether any code has changed. To avoid this, provide a stable nonce value that only
changes when you intentionally want to force a redeployment (e.g., an image digest or a version string).
494 495 496 497 |
# File 'ecs/ec2_service.rb', line 494 def force_new_deployment(nonce = nil) Jsii::Type.check_type(nonce, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nonce") unless nonce.nil? jsii_call_method("forceNewDeployment", [nonce]) end |
#generate_physical_name ⇒ String
314 315 316 |
# File 'ecs/ec2_service.rb', line 314 def generate_physical_name() jsii_call_method("generatePhysicalName", []) end |
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).
Normally, this token will resolve to arn_attr, but if the resource is
referenced across environments, arn_components will be used to synthesize
a concrete ARN with the resource's physical name. Make sure to reference
this.physicalName in arn_components.
328 329 330 331 332 333 |
# File 'ecs/ec2_service.rb', line 328 def get_resource_arn_attribute(arn_attr, arn_components) Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr") arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents") jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components]) end |
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).
Normally, this token will resolve to name_attr, but if the resource is
referenced across environments, it will be resolved to this.physicalName,
which will be a concrete name.
343 344 345 346 |
# File 'ecs/ec2_service.rb', line 343 def get_resource_name_attribute(name_attr) Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr") jsii_call_method("getResourceNameAttribute", [name_attr]) end |
#is_using_ecs_deployment_controller ⇒ Boolean
Checks if the service is using the ECS deployment controller.
502 503 504 |
# File 'ecs/ec2_service.rb', line 502 def is_using_ecs_deployment_controller() jsii_call_method("isUsingECSDeploymentController", []) end |
#load_balancer_target(options) ⇒ AWSCDK::ECS::IECSLoadBalancerTarget
Return a load balancing target for a specific container and port.
Use this function to create a load balancer target if you want to load balance to another container than the first essential container or the first mapped port on the container.
Use the return value of this function where you would normally use a load balancer
target, instead of the Service object itself.
530 531 532 533 534 |
# File 'ecs/ec2_service.rb', line 530 def load_balancer_target() = .is_a?(Hash) ? ::AWSCDK::ECS::LoadBalancerTargetOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxvYWRCYWxhbmNlclRhcmdldE9wdGlvbnMifQ==")), "options") jsii_call_method("loadBalancerTarget", []) end |
#load_balancers ⇒ Array<AWSCDK::ECS::CfnService::LoadBalancerProperty>
A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
192 193 194 |
# File 'ecs/ec2_service.rb', line 192 def load_balancers() jsii_get_property("loadBalancers") end |
#load_balancers=(value) ⇒ Object
196 197 198 199 200 |
# File 'ecs/ec2_service.rb', line 196 def load_balancers=(value) value = value.is_a?(Array) ? value.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::LoadBalancerProperty.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : value Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuU2VydmljZS5Mb2FkQmFsYW5jZXJQcm9wZXJ0eSJ9LCJraW5kIjoiYXJyYXkifX0=")), "loadBalancers") jsii_set_property("loadBalancers", value) end |
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
This method returns the specified CloudWatch metric name for this service.
541 542 543 544 545 546 |
# File 'ecs/ec2_service.rb', line 541 def metric(metric_name, props = nil) Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName") props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metric", [metric_name, props]) end |
#metric_cpu_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: average over 5 minutes
This method returns the CloudWatch metric for this service's CPU utilization.
553 554 555 556 557 |
# File 'ecs/ec2_service.rb', line 553 def metric_cpu_utilization(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricCpuUtilization", [props]) end |
#metric_memory_utilization(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: average over 5 minutes
This method returns the CloudWatch metric for this service's memory utilization.
564 565 566 567 568 |
# File 'ecs/ec2_service.rb', line 564 def metric_memory_utilization(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricMemoryUtilization", [props]) end |
#network_configuration ⇒ AWSCDK::ECS::CfnService::NetworkConfigurationProperty?
241 242 243 |
# File 'ecs/ec2_service.rb', line 241 def network_configuration() jsii_get_property("networkConfiguration") end |
#network_configuration=(value) ⇒ Object
245 246 247 248 249 |
# File 'ecs/ec2_service.rb', line 245 def network_configuration=(value) value = value.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::NetworkConfigurationProperty.new(**value.transform_keys(&:to_sym)) : value Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNmblNlcnZpY2UuTmV0d29ya0NvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9")), "networkConfiguration") unless value.nil? jsii_set_property("networkConfiguration", value) end |
#node ⇒ Constructs::Node
The tree node.
100 101 102 |
# File 'ecs/ec2_service.rb', line 100 def node() jsii_get_property("node") end |
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
This value will resolve to one of the following:
- a concrete value (e.g.
"my-awesome-bucket") undefined, when a name should be generated by CloudFormation- a concrete name generated automatically during synthesis, in cross-environment scenarios.
129 130 131 |
# File 'ecs/ec2_service.rb', line 129 def physical_name() jsii_get_property("physicalName") end |
#register_load_balancer_targets(*targets) ⇒ void
This method returns an undefined value.
Use this function to create all load balancer targets to be registered in this service, add them to target groups, and attach target groups to listeners accordingly.
Alternatively, you can use listener.addTargets() to create targets and add them to target groups.
588 589 590 591 592 593 594 |
# File 'ecs/ec2_service.rb', line 588 def register_load_balancer_targets(*targets) targets.map! { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::ECSTarget.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } targets.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkVjc1RhcmdldCJ9")), "targets[#{index}]") end jsii_call_method("registerLoadBalancerTargets", [*targets]) end |
#service_arn ⇒ String
The Amazon Resource Name (ARN) of the service.
157 158 159 |
# File 'ecs/ec2_service.rb', line 157 def service_arn() jsii_get_property("serviceArn") end |
#service_name ⇒ String
The name of the service.
164 165 166 |
# File 'ecs/ec2_service.rb', line 164 def service_name() jsii_get_property("serviceName") end |
#service_ref ⇒ AWSCDK::Interfaces::AWSECS::ServiceReference
A reference to this service.
171 172 173 |
# File 'ecs/ec2_service.rb', line 171 def service_ref() jsii_get_property("serviceRef") end |
#service_registries ⇒ Array<AWSCDK::ECS::CfnService::ServiceRegistryProperty>
The details of the service discovery registries to assign to this service.
For more information, see Service Discovery.
207 208 209 |
# File 'ecs/ec2_service.rb', line 207 def service_registries() jsii_get_property("serviceRegistries") end |
#service_registries=(value) ⇒ Object
211 212 213 214 215 |
# File 'ecs/ec2_service.rb', line 211 def service_registries=(value) value = value.is_a?(Array) ? value.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::ServiceRegistryProperty.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : value Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuU2VydmljZS5TZXJ2aWNlUmVnaXN0cnlQcm9wZXJ0eSJ9LCJraW5kIjoiYXJyYXkifX0=")), "serviceRegistries") jsii_set_property("serviceRegistries", value) end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
136 137 138 |
# File 'ecs/ec2_service.rb', line 136 def stack() jsii_get_property("stack") end |
#task_definition ⇒ AWSCDK::ECS::TaskDefinition
The task definition to use for tasks in the service.
178 179 180 |
# File 'ecs/ec2_service.rb', line 178 def task_definition() jsii_get_property("taskDefinition") end |
#to_string ⇒ String
Returns a string representation of this construct.
261 262 263 |
# File 'ecs/ec2_service.rb', line 261 def to_string() jsii_call_method("toString", []) end |
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
274 275 276 277 278 279 |
# File 'ecs/ec2_service.rb', line 274 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |