Documentation ¶
Index ¶
- func ApplicationLoadBalancedEc2Service_IsConstruct(x interface{}) *bool
- func ApplicationLoadBalancedFargateService_IsConstruct(x interface{}) *bool
- func ApplicationLoadBalancedServiceBase_IsConstruct(x interface{}) *bool
- func ApplicationMultipleTargetGroupsEc2Service_IsConstruct(x interface{}) *bool
- func ApplicationMultipleTargetGroupsFargateService_IsConstruct(x interface{}) *bool
- func ApplicationMultipleTargetGroupsServiceBase_IsConstruct(x interface{}) *bool
- func NetworkLoadBalancedEc2Service_IsConstruct(x interface{}) *bool
- func NetworkLoadBalancedFargateService_IsConstruct(x interface{}) *bool
- func NetworkLoadBalancedServiceBase_IsConstruct(x interface{}) *bool
- func NetworkMultipleTargetGroupsEc2Service_IsConstruct(x interface{}) *bool
- func NetworkMultipleTargetGroupsFargateService_IsConstruct(x interface{}) *bool
- func NetworkMultipleTargetGroupsServiceBase_IsConstruct(x interface{}) *bool
- func NewApplicationLoadBalancedEc2Service_Override(a ApplicationLoadBalancedEc2Service, scope constructs.Construct, id *string, ...)
- func NewApplicationLoadBalancedFargateService_Override(a ApplicationLoadBalancedFargateService, scope constructs.Construct, ...)
- func NewApplicationLoadBalancedServiceBase_Override(a ApplicationLoadBalancedServiceBase, scope constructs.Construct, id *string, ...)
- func NewApplicationMultipleTargetGroupsEc2Service_Override(a ApplicationMultipleTargetGroupsEc2Service, scope constructs.Construct, ...)
- func NewApplicationMultipleTargetGroupsFargateService_Override(a ApplicationMultipleTargetGroupsFargateService, scope constructs.Construct, ...)
- func NewApplicationMultipleTargetGroupsServiceBase_Override(a ApplicationMultipleTargetGroupsServiceBase, scope constructs.Construct, ...)
- func NewNetworkLoadBalancedEc2Service_Override(n NetworkLoadBalancedEc2Service, scope constructs.Construct, id *string, ...)
- func NewNetworkLoadBalancedFargateService_Override(n NetworkLoadBalancedFargateService, scope constructs.Construct, id *string, ...)
- func NewNetworkLoadBalancedServiceBase_Override(n NetworkLoadBalancedServiceBase, scope constructs.Construct, id *string, ...)
- func NewNetworkMultipleTargetGroupsEc2Service_Override(n NetworkMultipleTargetGroupsEc2Service, scope constructs.Construct, ...)
- func NewNetworkMultipleTargetGroupsFargateService_Override(n NetworkMultipleTargetGroupsFargateService, scope constructs.Construct, ...)
- func NewNetworkMultipleTargetGroupsServiceBase_Override(n NetworkMultipleTargetGroupsServiceBase, scope constructs.Construct, ...)
- func NewQueueProcessingEc2Service_Override(q QueueProcessingEc2Service, scope constructs.Construct, id *string, ...)
- func NewQueueProcessingFargateService_Override(q QueueProcessingFargateService, scope constructs.Construct, id *string, ...)
- func NewQueueProcessingServiceBase_Override(q QueueProcessingServiceBase, scope constructs.Construct, id *string, ...)
- func NewScheduledEc2Task_Override(s ScheduledEc2Task, scope constructs.Construct, id *string, ...)
- func NewScheduledFargateTask_Override(s ScheduledFargateTask, scope constructs.Construct, id *string, ...)
- func NewScheduledTaskBase_Override(s ScheduledTaskBase, scope constructs.Construct, id *string, ...)
- func QueueProcessingEc2Service_IsConstruct(x interface{}) *bool
- func QueueProcessingFargateService_IsConstruct(x interface{}) *bool
- func QueueProcessingServiceBase_IsConstruct(x interface{}) *bool
- func ScheduledEc2Task_IsConstruct(x interface{}) *bool
- func ScheduledFargateTask_IsConstruct(x interface{}) *bool
- func ScheduledTaskBase_IsConstruct(x interface{}) *bool
- type ApplicationListenerProps
- type ApplicationLoadBalancedEc2Service
- type ApplicationLoadBalancedEc2ServiceProps
- type ApplicationLoadBalancedFargateService
- type ApplicationLoadBalancedFargateServiceProps
- type ApplicationLoadBalancedServiceBase
- type ApplicationLoadBalancedServiceBaseProps
- type ApplicationLoadBalancedServiceRecordType
- type ApplicationLoadBalancedTaskImageOptions
- type ApplicationLoadBalancedTaskImageProps
- type ApplicationLoadBalancerProps
- type ApplicationMultipleTargetGroupsEc2Service
- type ApplicationMultipleTargetGroupsEc2ServiceProps
- type ApplicationMultipleTargetGroupsFargateService
- type ApplicationMultipleTargetGroupsFargateServiceProps
- type ApplicationMultipleTargetGroupsServiceBase
- type ApplicationMultipleTargetGroupsServiceBaseProps
- type ApplicationTargetProps
- type FargateServiceBaseProps
- type NetworkListenerProps
- type NetworkLoadBalancedEc2Service
- type NetworkLoadBalancedEc2ServiceProps
- type NetworkLoadBalancedFargateService
- type NetworkLoadBalancedFargateServiceProps
- type NetworkLoadBalancedServiceBase
- type NetworkLoadBalancedServiceBaseProps
- type NetworkLoadBalancedServiceRecordType
- type NetworkLoadBalancedTaskImageOptions
- type NetworkLoadBalancedTaskImageProps
- type NetworkLoadBalancerProps
- type NetworkMultipleTargetGroupsEc2Service
- type NetworkMultipleTargetGroupsEc2ServiceProps
- type NetworkMultipleTargetGroupsFargateService
- type NetworkMultipleTargetGroupsFargateServiceProps
- type NetworkMultipleTargetGroupsServiceBase
- type NetworkMultipleTargetGroupsServiceBaseProps
- type NetworkTargetProps
- type QueueProcessingEc2Service
- type QueueProcessingEc2ServiceProps
- type QueueProcessingFargateService
- type QueueProcessingFargateServiceProps
- type QueueProcessingServiceBase
- type QueueProcessingServiceBaseProps
- type ScheduledEc2Task
- type ScheduledEc2TaskDefinitionOptions
- type ScheduledEc2TaskImageOptions
- type ScheduledEc2TaskProps
- type ScheduledFargateTask
- type ScheduledFargateTaskDefinitionOptions
- type ScheduledFargateTaskImageOptions
- type ScheduledFargateTaskProps
- type ScheduledTaskBase
- type ScheduledTaskBaseProps
- type ScheduledTaskImageProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplicationLoadBalancedEc2Service_IsConstruct ¶
func ApplicationLoadBalancedEc2Service_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func ApplicationLoadBalancedFargateService_IsConstruct ¶
func ApplicationLoadBalancedFargateService_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func ApplicationLoadBalancedServiceBase_IsConstruct ¶
func ApplicationLoadBalancedServiceBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func ApplicationMultipleTargetGroupsEc2Service_IsConstruct ¶
func ApplicationMultipleTargetGroupsEc2Service_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func ApplicationMultipleTargetGroupsFargateService_IsConstruct ¶
func ApplicationMultipleTargetGroupsFargateService_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func ApplicationMultipleTargetGroupsServiceBase_IsConstruct ¶
func ApplicationMultipleTargetGroupsServiceBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func NetworkLoadBalancedEc2Service_IsConstruct ¶
func NetworkLoadBalancedEc2Service_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func NetworkLoadBalancedFargateService_IsConstruct ¶
func NetworkLoadBalancedFargateService_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func NetworkLoadBalancedServiceBase_IsConstruct ¶
func NetworkLoadBalancedServiceBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func NetworkMultipleTargetGroupsEc2Service_IsConstruct ¶
func NetworkMultipleTargetGroupsEc2Service_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func NetworkMultipleTargetGroupsFargateService_IsConstruct ¶
func NetworkMultipleTargetGroupsFargateService_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func NetworkMultipleTargetGroupsServiceBase_IsConstruct ¶
func NetworkMultipleTargetGroupsServiceBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func NewApplicationLoadBalancedEc2Service_Override ¶
func NewApplicationLoadBalancedEc2Service_Override(a ApplicationLoadBalancedEc2Service, scope constructs.Construct, id *string, props *ApplicationLoadBalancedEc2ServiceProps)
Constructs a new instance of the ApplicationLoadBalancedEc2Service class.
func NewApplicationLoadBalancedFargateService_Override ¶
func NewApplicationLoadBalancedFargateService_Override(a ApplicationLoadBalancedFargateService, scope constructs.Construct, id *string, props *ApplicationLoadBalancedFargateServiceProps)
Constructs a new instance of the ApplicationLoadBalancedFargateService class.
func NewApplicationLoadBalancedServiceBase_Override ¶
func NewApplicationLoadBalancedServiceBase_Override(a ApplicationLoadBalancedServiceBase, scope constructs.Construct, id *string, props *ApplicationLoadBalancedServiceBaseProps)
Constructs a new instance of the ApplicationLoadBalancedServiceBase class.
func NewApplicationMultipleTargetGroupsEc2Service_Override ¶
func NewApplicationMultipleTargetGroupsEc2Service_Override(a ApplicationMultipleTargetGroupsEc2Service, scope constructs.Construct, id *string, props *ApplicationMultipleTargetGroupsEc2ServiceProps)
Constructs a new instance of the ApplicationMultipleTargetGroupsEc2Service class.
func NewApplicationMultipleTargetGroupsFargateService_Override ¶
func NewApplicationMultipleTargetGroupsFargateService_Override(a ApplicationMultipleTargetGroupsFargateService, scope constructs.Construct, id *string, props *ApplicationMultipleTargetGroupsFargateServiceProps)
Constructs a new instance of the ApplicationMultipleTargetGroupsFargateService class.
func NewApplicationMultipleTargetGroupsServiceBase_Override ¶
func NewApplicationMultipleTargetGroupsServiceBase_Override(a ApplicationMultipleTargetGroupsServiceBase, scope constructs.Construct, id *string, props *ApplicationMultipleTargetGroupsServiceBaseProps)
Constructs a new instance of the ApplicationMultipleTargetGroupsServiceBase class.
func NewNetworkLoadBalancedEc2Service_Override ¶
func NewNetworkLoadBalancedEc2Service_Override(n NetworkLoadBalancedEc2Service, scope constructs.Construct, id *string, props *NetworkLoadBalancedEc2ServiceProps)
Constructs a new instance of the NetworkLoadBalancedEc2Service class.
func NewNetworkLoadBalancedFargateService_Override ¶
func NewNetworkLoadBalancedFargateService_Override(n NetworkLoadBalancedFargateService, scope constructs.Construct, id *string, props *NetworkLoadBalancedFargateServiceProps)
Constructs a new instance of the NetworkLoadBalancedFargateService class.
func NewNetworkLoadBalancedServiceBase_Override ¶
func NewNetworkLoadBalancedServiceBase_Override(n NetworkLoadBalancedServiceBase, scope constructs.Construct, id *string, props *NetworkLoadBalancedServiceBaseProps)
Constructs a new instance of the NetworkLoadBalancedServiceBase class.
func NewNetworkMultipleTargetGroupsEc2Service_Override ¶
func NewNetworkMultipleTargetGroupsEc2Service_Override(n NetworkMultipleTargetGroupsEc2Service, scope constructs.Construct, id *string, props *NetworkMultipleTargetGroupsEc2ServiceProps)
Constructs a new instance of the NetworkMultipleTargetGroupsEc2Service class.
func NewNetworkMultipleTargetGroupsFargateService_Override ¶
func NewNetworkMultipleTargetGroupsFargateService_Override(n NetworkMultipleTargetGroupsFargateService, scope constructs.Construct, id *string, props *NetworkMultipleTargetGroupsFargateServiceProps)
Constructs a new instance of the NetworkMultipleTargetGroupsFargateService class.
func NewNetworkMultipleTargetGroupsServiceBase_Override ¶
func NewNetworkMultipleTargetGroupsServiceBase_Override(n NetworkMultipleTargetGroupsServiceBase, scope constructs.Construct, id *string, props *NetworkMultipleTargetGroupsServiceBaseProps)
Constructs a new instance of the NetworkMultipleTargetGroupsServiceBase class.
func NewQueueProcessingEc2Service_Override ¶
func NewQueueProcessingEc2Service_Override(q QueueProcessingEc2Service, scope constructs.Construct, id *string, props *QueueProcessingEc2ServiceProps)
Constructs a new instance of the QueueProcessingEc2Service class.
func NewQueueProcessingFargateService_Override ¶
func NewQueueProcessingFargateService_Override(q QueueProcessingFargateService, scope constructs.Construct, id *string, props *QueueProcessingFargateServiceProps)
Constructs a new instance of the QueueProcessingFargateService class.
func NewQueueProcessingServiceBase_Override ¶
func NewQueueProcessingServiceBase_Override(q QueueProcessingServiceBase, scope constructs.Construct, id *string, props *QueueProcessingServiceBaseProps)
Constructs a new instance of the QueueProcessingServiceBase class.
func NewScheduledEc2Task_Override ¶
func NewScheduledEc2Task_Override(s ScheduledEc2Task, scope constructs.Construct, id *string, props *ScheduledEc2TaskProps)
Constructs a new instance of the ScheduledEc2Task class.
func NewScheduledFargateTask_Override ¶
func NewScheduledFargateTask_Override(s ScheduledFargateTask, scope constructs.Construct, id *string, props *ScheduledFargateTaskProps)
Constructs a new instance of the ScheduledFargateTask class.
func NewScheduledTaskBase_Override ¶
func NewScheduledTaskBase_Override(s ScheduledTaskBase, scope constructs.Construct, id *string, props *ScheduledTaskBaseProps)
Constructs a new instance of the ScheduledTaskBase class.
func QueueProcessingEc2Service_IsConstruct ¶
func QueueProcessingEc2Service_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func QueueProcessingFargateService_IsConstruct ¶
func QueueProcessingFargateService_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func QueueProcessingServiceBase_IsConstruct ¶
func QueueProcessingServiceBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func ScheduledEc2Task_IsConstruct ¶
func ScheduledEc2Task_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func ScheduledFargateTask_IsConstruct ¶
func ScheduledFargateTask_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func ScheduledTaskBase_IsConstruct ¶
func ScheduledTaskBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
Types ¶
type ApplicationListenerProps ¶
type ApplicationListenerProps struct { // Name of the listener. Name *string `field:"required" json:"name" yaml:"name"` // Certificate Manager certificate to associate with the load balancer. // // Setting this option will set the load balancer protocol to HTTPS. // Default: - No certificate associated with the load balancer, if using // the HTTP protocol. For HTTPS, a DNS-validated certificate will be // created for the load balancer's specified domain name. // Certificate awscertificatemanager.ICertificate `field:"optional" json:"certificate" yaml:"certificate"` // The port on which the listener listens for requests. // Default: - Determined from protocol if known. // Port *float64 `field:"optional" json:"port" yaml:"port"` // The protocol for connections from clients to the load balancer. // // The load balancer port is determined from the protocol (port 80 for // HTTP, port 443 for HTTPS). A domain name and zone must be also be // specified if using HTTPS. // Default: ApplicationProtocol.HTTP. If a certificate is specified, the protocol will be // set by default to ApplicationProtocol.HTTPS. // Protocol awselasticloadbalancingv2.ApplicationProtocol `field:"optional" json:"protocol" yaml:"protocol"` // The security policy that defines which ciphers and protocols are supported by the ALB Listener. // Default: - The recommended elastic load balancing security policy. // SslPolicy awselasticloadbalancingv2.SslPolicy `field:"optional" json:"sslPolicy" yaml:"sslPolicy"` }
Properties to define an application listener.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var certificate certificate applicationListenerProps := &ApplicationListenerProps{ Name: jsii.String("name"), // the properties below are optional Certificate: certificate, Port: jsii.Number(123), Protocol: awscdk.Aws_elasticloadbalancingv2.ApplicationProtocol_HTTP, SslPolicy: awscdk.*Aws_elasticloadbalancingv2.SslPolicy_RECOMMENDED_TLS, }
type ApplicationLoadBalancedEc2Service ¶
type ApplicationLoadBalancedEc2Service interface { ApplicationLoadBalancedServiceBase // Certificate Manager certificate to associate with the load balancer. Certificate() awscertificatemanager.ICertificate // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service if one is not provided. InternalDesiredCount() *float64 // The listener for the service. Listener() awselasticloadbalancingv2.ApplicationListener // The Application Load Balancer for the service. LoadBalancer() awselasticloadbalancingv2.ApplicationLoadBalancer // The tree node. Node() constructs.Node // The redirect listener for the service if redirectHTTP is enabled. RedirectListener() awselasticloadbalancingv2.ApplicationListener // The EC2 service in this construct. Service() awsecs.Ec2Service // The target group for the service. TargetGroup() awselasticloadbalancingv2.ApplicationTargetGroup // The EC2 Task Definition in this construct. TaskDefinition() awsecs.Ec2TaskDefinition // Adds service as a target of the target group. AddServiceAsTarget(service awsecs.BaseService) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Returns a string representation of this construct. ToString() *string }
An EC2 service running on an ECS cluster fronted by an application load balancer.
Example:
var cluster cluster loadBalancedEcsService := ecsPatterns.NewApplicationLoadBalancedEc2Service(this, jsii.String("Service"), &ApplicationLoadBalancedEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), TaskImageOptions: &ApplicationLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("test")), Environment: map[string]*string{ "TEST_ENVIRONMENT_VARIABLE1": jsii.String("test environment variable 1 value"), "TEST_ENVIRONMENT_VARIABLE2": jsii.String("test environment variable 2 value"), }, Command: []*string{ jsii.String("command"), }, EntryPoint: []*string{ jsii.String("entry"), jsii.String("point"), }, }, DesiredCount: jsii.Number(2), })
func NewApplicationLoadBalancedEc2Service ¶
func NewApplicationLoadBalancedEc2Service(scope constructs.Construct, id *string, props *ApplicationLoadBalancedEc2ServiceProps) ApplicationLoadBalancedEc2Service
Constructs a new instance of the ApplicationLoadBalancedEc2Service class.
type ApplicationLoadBalancedEc2ServiceProps ¶
type ApplicationLoadBalancedEc2ServiceProps struct { // A list of Capacity Provider strategies used to place a service. // Default: - undefined. // CapacityProviderStrategies *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Certificate Manager certificate to associate with the load balancer. // // Setting this option will set the load balancer protocol to HTTPS. // Default: - No certificate associated with the load balancer, if using // the HTTP protocol. For HTTPS, a DNS-validated certificate will be // created for the load balancer's specified domain name if a domain name // and domain zone are specified. // Certificate awscertificatemanager.ICertificate `field:"optional" json:"certificate" yaml:"certificate"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. // Default: - disabled. // CircuitBreaker *awsecs.DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) // Default: - Rolling update (ECS). // DeploymentController *awsecs.DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // The domain name for the service, e.g. "api.example.com.". // Default: - No domain name. // DomainName *string `field:"optional" json:"domainName" yaml:"domainName"` // The Route53 hosted zone for the domain, e.g. "example.com.". // Default: - No Route53 hosted domain zone. // DomainZone awsroute53.IHostedZone `field:"optional" json:"domainZone" yaml:"domainZone"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The load balancer idle timeout, in seconds. // // Can be between 1 and 4000 seconds. // Default: - CloudFormation sets idle timeout to 60 seconds. // IdleTimeout awscdk.Duration `field:"optional" json:"idleTimeout" yaml:"idleTimeout"` // The type of IP address to use. // Default: - IpAddressType.IPV4 // IpAddressType awselasticloadbalancingv2.IpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"` // Listener port of the application load balancer that will serve traffic to the service. // Default: - The default listener port is determined from the protocol (port 80 for HTTP, // port 443 for HTTPS). A domain name and zone must be also be specified if using HTTPS. // ListenerPort *float64 `field:"optional" json:"listenerPort" yaml:"listenerPort"` // The application load balancer that will serve traffic to the service. // // The VPC attribute of a load balancer must be specified for it to be used // to create a new service with this pattern. // // [disable-awslint:ref-via-interface]. // Default: - a new load balancer will be created. // LoadBalancer awselasticloadbalancingv2.IApplicationLoadBalancer `field:"optional" json:"loadBalancer" yaml:"loadBalancer"` // Name of the load balancer. // Default: - Automatically generated name. // LoadBalancerName *string `field:"optional" json:"loadBalancerName" yaml:"loadBalancerName"` // The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. // Default: - 100 if daemon, otherwise 200. // MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. // Default: - 0 if daemon, otherwise 50. // MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // Determines whether or not the Security Group for the Load Balancer's Listener will be open to all traffic by default. // Default: true -- The security group allows ingress from all IP addresses. // OpenListener *bool `field:"optional" json:"openListener" yaml:"openListener"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // The protocol for connections from clients to the load balancer. // // The load balancer port is determined from the protocol (port 80 for // HTTP, port 443 for HTTPS). If HTTPS, either a certificate or domain // name and domain zone must also be specified. // Default: HTTP. If a certificate is specified, the protocol will be // set by default to HTTPS. // Protocol awselasticloadbalancingv2.ApplicationProtocol `field:"optional" json:"protocol" yaml:"protocol"` // The protocol version to use. // Default: ApplicationProtocolVersion.HTTP1 // ProtocolVersion awselasticloadbalancingv2.ApplicationProtocolVersion `field:"optional" json:"protocolVersion" yaml:"protocolVersion"` // Determines whether the Load Balancer will be internet-facing. // Default: true. // PublicLoadBalancer *bool `field:"optional" json:"publicLoadBalancer" yaml:"publicLoadBalancer"` // Specifies whether the Route53 record should be a CNAME, an A record using the Alias feature or no record at all. // // This is useful if you need to work with DNS systems that do not support alias records. // Default: ApplicationLoadBalancedServiceRecordType.ALIAS // RecordType ApplicationLoadBalancedServiceRecordType `field:"optional" json:"recordType" yaml:"recordType"` // Specifies whether the load balancer should redirect traffic on port 80 to port 443 to support HTTP->HTTPS redirects This is only valid if the protocol of the ALB is HTTPS. // Default: false. // RedirectHTTP *bool `field:"optional" json:"redirectHTTP" yaml:"redirectHTTP"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // The security policy that defines which ciphers and protocols are supported by the ALB Listener. // Default: - The recommended elastic load balancing security policy. // SslPolicy awselasticloadbalancingv2.SslPolicy `field:"optional" json:"sslPolicy" yaml:"sslPolicy"` // The protocol for connections from the load balancer to the ECS tasks. // // The default target port is determined from the protocol (port 80 for // HTTP, port 443 for HTTPS). // Default: HTTP. // TargetProtocol awselasticloadbalancingv2.ApplicationProtocol `field:"optional" json:"targetProtocol" yaml:"targetProtocol"` // The properties required to create a new task definition. // // TaskDefinition or TaskImageOptions must be specified, but not both. // Default: none. // TaskImageOptions *ApplicationLoadBalancedTaskImageOptions `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: none. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The hard limit (in MiB) of memory to present to the container. // // If your container attempts to exceed the allocated memory, the container // is terminated. // // At least one of memoryLimitMiB and memoryReservationMiB is required. // Default: - No memory limit. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // The soft limit (in MiB) of memory to reserve for the container. // // When system memory is under contention, Docker attempts to keep the // container memory within the limit. If the container requires more memory, // it can consume up to the value specified by the Memory property or all of // the available memory on the container instance—whichever comes first. // // At least one of memoryLimitMiB and memoryReservationMiB is required. // Default: - No memory reserved. // MemoryReservationMiB *float64 `field:"optional" json:"memoryReservationMiB" yaml:"memoryReservationMiB"` // The placement constraints to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html). // Default: - No constraints. // PlacementConstraints *[]awsecs.PlacementConstraint `field:"optional" json:"placementConstraints" yaml:"placementConstraints"` // The placement strategies to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html). // Default: - No strategies. // PlacementStrategies *[]awsecs.PlacementStrategy `field:"optional" json:"placementStrategies" yaml:"placementStrategies"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both.. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.Ec2TaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` }
The properties for the ApplicationLoadBalancedEc2Service service.
Example:
var cluster cluster loadBalancedEcsService := ecsPatterns.NewApplicationLoadBalancedEc2Service(this, jsii.String("Service"), &ApplicationLoadBalancedEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), TaskImageOptions: &ApplicationLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("test")), Environment: map[string]*string{ "TEST_ENVIRONMENT_VARIABLE1": jsii.String("test environment variable 1 value"), "TEST_ENVIRONMENT_VARIABLE2": jsii.String("test environment variable 2 value"), }, Command: []*string{ jsii.String("command"), }, EntryPoint: []*string{ jsii.String("entry"), jsii.String("point"), }, }, DesiredCount: jsii.Number(2), })
type ApplicationLoadBalancedFargateService ¶
type ApplicationLoadBalancedFargateService interface { ApplicationLoadBalancedServiceBase // Determines whether the service will be assigned a public IP address. AssignPublicIp() *bool // Certificate Manager certificate to associate with the load balancer. Certificate() awscertificatemanager.ICertificate // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service if one is not provided. InternalDesiredCount() *float64 // The listener for the service. Listener() awselasticloadbalancingv2.ApplicationListener // The Application Load Balancer for the service. LoadBalancer() awselasticloadbalancingv2.ApplicationLoadBalancer // The tree node. Node() constructs.Node // The redirect listener for the service if redirectHTTP is enabled. RedirectListener() awselasticloadbalancingv2.ApplicationListener // The Fargate service in this construct. Service() awsecs.FargateService // The target group for the service. TargetGroup() awselasticloadbalancingv2.ApplicationTargetGroup // The Fargate task definition in this construct. TaskDefinition() awsecs.FargateTaskDefinition // Adds service as a target of the target group. AddServiceAsTarget(service awsecs.BaseService) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Returns a string representation of this construct. ToString() *string }
A Fargate service running on an ECS cluster fronted by an application load balancer.
Example:
var cluster cluster loadBalancedFargateService := ecsPatterns.NewApplicationLoadBalancedFargateService(this, jsii.String("Service"), &ApplicationLoadBalancedFargateServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), DesiredCount: jsii.Number(1), Cpu: jsii.Number(512), TaskImageOptions: &ApplicationLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, }) scalableTarget := loadBalancedFargateService.Service.AutoScaleTaskCount(&EnableScalingProps{ MinCapacity: jsii.Number(1), MaxCapacity: jsii.Number(20), }) scalableTarget.ScaleOnCpuUtilization(jsii.String("CpuScaling"), &CpuUtilizationScalingProps{ TargetUtilizationPercent: jsii.Number(50), }) scalableTarget.ScaleOnMemoryUtilization(jsii.String("MemoryScaling"), &MemoryUtilizationScalingProps{ TargetUtilizationPercent: jsii.Number(50), })
func NewApplicationLoadBalancedFargateService ¶
func NewApplicationLoadBalancedFargateService(scope constructs.Construct, id *string, props *ApplicationLoadBalancedFargateServiceProps) ApplicationLoadBalancedFargateService
Constructs a new instance of the ApplicationLoadBalancedFargateService class.
type ApplicationLoadBalancedFargateServiceProps ¶
type ApplicationLoadBalancedFargateServiceProps struct { // A list of Capacity Provider strategies used to place a service. // Default: - undefined. // CapacityProviderStrategies *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Certificate Manager certificate to associate with the load balancer. // // Setting this option will set the load balancer protocol to HTTPS. // Default: - No certificate associated with the load balancer, if using // the HTTP protocol. For HTTPS, a DNS-validated certificate will be // created for the load balancer's specified domain name if a domain name // and domain zone are specified. // Certificate awscertificatemanager.ICertificate `field:"optional" json:"certificate" yaml:"certificate"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. // Default: - disabled. // CircuitBreaker *awsecs.DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) // Default: - Rolling update (ECS). // DeploymentController *awsecs.DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // The domain name for the service, e.g. "api.example.com.". // Default: - No domain name. // DomainName *string `field:"optional" json:"domainName" yaml:"domainName"` // The Route53 hosted zone for the domain, e.g. "example.com.". // Default: - No Route53 hosted domain zone. // DomainZone awsroute53.IHostedZone `field:"optional" json:"domainZone" yaml:"domainZone"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The load balancer idle timeout, in seconds. // // Can be between 1 and 4000 seconds. // Default: - CloudFormation sets idle timeout to 60 seconds. // IdleTimeout awscdk.Duration `field:"optional" json:"idleTimeout" yaml:"idleTimeout"` // The type of IP address to use. // Default: - IpAddressType.IPV4 // IpAddressType awselasticloadbalancingv2.IpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"` // Listener port of the application load balancer that will serve traffic to the service. // Default: - The default listener port is determined from the protocol (port 80 for HTTP, // port 443 for HTTPS). A domain name and zone must be also be specified if using HTTPS. // ListenerPort *float64 `field:"optional" json:"listenerPort" yaml:"listenerPort"` // The application load balancer that will serve traffic to the service. // // The VPC attribute of a load balancer must be specified for it to be used // to create a new service with this pattern. // // [disable-awslint:ref-via-interface]. // Default: - a new load balancer will be created. // LoadBalancer awselasticloadbalancingv2.IApplicationLoadBalancer `field:"optional" json:"loadBalancer" yaml:"loadBalancer"` // Name of the load balancer. // Default: - Automatically generated name. // LoadBalancerName *string `field:"optional" json:"loadBalancerName" yaml:"loadBalancerName"` // The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. // Default: - 100 if daemon, otherwise 200. // MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. // Default: - 0 if daemon, otherwise 50. // MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // Determines whether or not the Security Group for the Load Balancer's Listener will be open to all traffic by default. // Default: true -- The security group allows ingress from all IP addresses. // OpenListener *bool `field:"optional" json:"openListener" yaml:"openListener"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // The protocol for connections from clients to the load balancer. // // The load balancer port is determined from the protocol (port 80 for // HTTP, port 443 for HTTPS). If HTTPS, either a certificate or domain // name and domain zone must also be specified. // Default: HTTP. If a certificate is specified, the protocol will be // set by default to HTTPS. // Protocol awselasticloadbalancingv2.ApplicationProtocol `field:"optional" json:"protocol" yaml:"protocol"` // The protocol version to use. // Default: ApplicationProtocolVersion.HTTP1 // ProtocolVersion awselasticloadbalancingv2.ApplicationProtocolVersion `field:"optional" json:"protocolVersion" yaml:"protocolVersion"` // Determines whether the Load Balancer will be internet-facing. // Default: true. // PublicLoadBalancer *bool `field:"optional" json:"publicLoadBalancer" yaml:"publicLoadBalancer"` // Specifies whether the Route53 record should be a CNAME, an A record using the Alias feature or no record at all. // // This is useful if you need to work with DNS systems that do not support alias records. // Default: ApplicationLoadBalancedServiceRecordType.ALIAS // RecordType ApplicationLoadBalancedServiceRecordType `field:"optional" json:"recordType" yaml:"recordType"` // Specifies whether the load balancer should redirect traffic on port 80 to port 443 to support HTTP->HTTPS redirects This is only valid if the protocol of the ALB is HTTPS. // Default: false. // RedirectHTTP *bool `field:"optional" json:"redirectHTTP" yaml:"redirectHTTP"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // The security policy that defines which ciphers and protocols are supported by the ALB Listener. // Default: - The recommended elastic load balancing security policy. // SslPolicy awselasticloadbalancingv2.SslPolicy `field:"optional" json:"sslPolicy" yaml:"sslPolicy"` // The protocol for connections from the load balancer to the ECS tasks. // // The default target port is determined from the protocol (port 80 for // HTTP, port 443 for HTTPS). // Default: HTTP. // TargetProtocol awselasticloadbalancingv2.ApplicationProtocol `field:"optional" json:"targetProtocol" yaml:"targetProtocol"` // The properties required to create a new task definition. // // TaskDefinition or TaskImageOptions must be specified, but not both. // Default: none. // TaskImageOptions *ApplicationLoadBalancedTaskImageOptions `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments // // 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: 256. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in GiB) of ephemeral storage to be allocated to the task. // // The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. // // Only supported in Fargate platform version 1.4.0 or later. // Default: Undefined, in which case, the task will receive 20GiB ephemeral storage. // EphemeralStorageGiB *float64 `field:"optional" json:"ephemeralStorageGiB" yaml:"ephemeralStorageGiB"` // The amount (in MiB) of memory used by the task. // // This field is required and you must use one of the following values, which determines your range of valid values // for the cpu parameter: // // 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) // // 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) // // 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) // // Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) // // Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) // // Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) // // Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) // // This default is set in the underlying FargateTaskDefinition construct. // Default: 512. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // 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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) // in the Amazon Elastic Container Service Developer Guide. // Default: Latest. // PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // The runtime platform of the task definition. // Default: - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64. // RuntimePlatform *awsecs.RuntimePlatform `field:"optional" json:"runtimePlatform" yaml:"runtimePlatform"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.FargateTaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` // Determines whether the service will be assigned a public IP address. // Default: false. // AssignPublicIp *bool `field:"optional" json:"assignPublicIp" yaml:"assignPublicIp"` // The health check command and associated configuration parameters for the container. // Default: - Health check configuration from container. // HealthCheck *awsecs.HealthCheck `field:"optional" json:"healthCheck" yaml:"healthCheck"` // 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. // SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // 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. // TaskSubnets *awsec2.SubnetSelection `field:"optional" json:"taskSubnets" yaml:"taskSubnets"` }
The properties for the ApplicationLoadBalancedFargateService service.
Example:
var cluster cluster loadBalancedFargateService := ecsPatterns.NewApplicationLoadBalancedFargateService(this, jsii.String("Service"), &ApplicationLoadBalancedFargateServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), DesiredCount: jsii.Number(1), Cpu: jsii.Number(512), TaskImageOptions: &ApplicationLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, }) scalableTarget := loadBalancedFargateService.Service.AutoScaleTaskCount(&EnableScalingProps{ MinCapacity: jsii.Number(1), MaxCapacity: jsii.Number(20), }) scalableTarget.ScaleOnCpuUtilization(jsii.String("CpuScaling"), &CpuUtilizationScalingProps{ TargetUtilizationPercent: jsii.Number(50), }) scalableTarget.ScaleOnMemoryUtilization(jsii.String("MemoryScaling"), &MemoryUtilizationScalingProps{ TargetUtilizationPercent: jsii.Number(50), })
type ApplicationLoadBalancedServiceBase ¶
type ApplicationLoadBalancedServiceBase interface { constructs.Construct // Certificate Manager certificate to associate with the load balancer. Certificate() awscertificatemanager.ICertificate // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service if one is not provided. InternalDesiredCount() *float64 // The listener for the service. Listener() awselasticloadbalancingv2.ApplicationListener // The Application Load Balancer for the service. LoadBalancer() awselasticloadbalancingv2.ApplicationLoadBalancer // The tree node. Node() constructs.Node // The redirect listener for the service if redirectHTTP is enabled. RedirectListener() awselasticloadbalancingv2.ApplicationListener // The target group for the service. TargetGroup() awselasticloadbalancingv2.ApplicationTargetGroup // Adds service as a target of the target group. AddServiceAsTarget(service awsecs.BaseService) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Returns a string representation of this construct. ToString() *string }
The base class for ApplicationLoadBalancedEc2Service and ApplicationLoadBalancedFargateService services.
type ApplicationLoadBalancedServiceBaseProps ¶
type ApplicationLoadBalancedServiceBaseProps struct { // A list of Capacity Provider strategies used to place a service. // Default: - undefined. // CapacityProviderStrategies *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Certificate Manager certificate to associate with the load balancer. // // Setting this option will set the load balancer protocol to HTTPS. // Default: - No certificate associated with the load balancer, if using // the HTTP protocol. For HTTPS, a DNS-validated certificate will be // created for the load balancer's specified domain name if a domain name // and domain zone are specified. // Certificate awscertificatemanager.ICertificate `field:"optional" json:"certificate" yaml:"certificate"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. // Default: - disabled. // CircuitBreaker *awsecs.DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) // Default: - Rolling update (ECS). // DeploymentController *awsecs.DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // The domain name for the service, e.g. "api.example.com.". // Default: - No domain name. // DomainName *string `field:"optional" json:"domainName" yaml:"domainName"` // The Route53 hosted zone for the domain, e.g. "example.com.". // Default: - No Route53 hosted domain zone. // DomainZone awsroute53.IHostedZone `field:"optional" json:"domainZone" yaml:"domainZone"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The load balancer idle timeout, in seconds. // // Can be between 1 and 4000 seconds. // Default: - CloudFormation sets idle timeout to 60 seconds. // IdleTimeout awscdk.Duration `field:"optional" json:"idleTimeout" yaml:"idleTimeout"` // The type of IP address to use. // Default: - IpAddressType.IPV4 // IpAddressType awselasticloadbalancingv2.IpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"` // Listener port of the application load balancer that will serve traffic to the service. // Default: - The default listener port is determined from the protocol (port 80 for HTTP, // port 443 for HTTPS). A domain name and zone must be also be specified if using HTTPS. // ListenerPort *float64 `field:"optional" json:"listenerPort" yaml:"listenerPort"` // The application load balancer that will serve traffic to the service. // // The VPC attribute of a load balancer must be specified for it to be used // to create a new service with this pattern. // // [disable-awslint:ref-via-interface]. // Default: - a new load balancer will be created. // LoadBalancer awselasticloadbalancingv2.IApplicationLoadBalancer `field:"optional" json:"loadBalancer" yaml:"loadBalancer"` // Name of the load balancer. // Default: - Automatically generated name. // LoadBalancerName *string `field:"optional" json:"loadBalancerName" yaml:"loadBalancerName"` // The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. // Default: - 100 if daemon, otherwise 200. // MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. // Default: - 0 if daemon, otherwise 50. // MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // Determines whether or not the Security Group for the Load Balancer's Listener will be open to all traffic by default. // Default: true -- The security group allows ingress from all IP addresses. // OpenListener *bool `field:"optional" json:"openListener" yaml:"openListener"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // The protocol for connections from clients to the load balancer. // // The load balancer port is determined from the protocol (port 80 for // HTTP, port 443 for HTTPS). If HTTPS, either a certificate or domain // name and domain zone must also be specified. // Default: HTTP. If a certificate is specified, the protocol will be // set by default to HTTPS. // Protocol awselasticloadbalancingv2.ApplicationProtocol `field:"optional" json:"protocol" yaml:"protocol"` // The protocol version to use. // Default: ApplicationProtocolVersion.HTTP1 // ProtocolVersion awselasticloadbalancingv2.ApplicationProtocolVersion `field:"optional" json:"protocolVersion" yaml:"protocolVersion"` // Determines whether the Load Balancer will be internet-facing. // Default: true. // PublicLoadBalancer *bool `field:"optional" json:"publicLoadBalancer" yaml:"publicLoadBalancer"` // Specifies whether the Route53 record should be a CNAME, an A record using the Alias feature or no record at all. // // This is useful if you need to work with DNS systems that do not support alias records. // Default: ApplicationLoadBalancedServiceRecordType.ALIAS // RecordType ApplicationLoadBalancedServiceRecordType `field:"optional" json:"recordType" yaml:"recordType"` // Specifies whether the load balancer should redirect traffic on port 80 to port 443 to support HTTP->HTTPS redirects This is only valid if the protocol of the ALB is HTTPS. // Default: false. // RedirectHTTP *bool `field:"optional" json:"redirectHTTP" yaml:"redirectHTTP"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // The security policy that defines which ciphers and protocols are supported by the ALB Listener. // Default: - The recommended elastic load balancing security policy. // SslPolicy awselasticloadbalancingv2.SslPolicy `field:"optional" json:"sslPolicy" yaml:"sslPolicy"` // The protocol for connections from the load balancer to the ECS tasks. // // The default target port is determined from the protocol (port 80 for // HTTP, port 443 for HTTPS). // Default: HTTP. // TargetProtocol awselasticloadbalancingv2.ApplicationProtocol `field:"optional" json:"targetProtocol" yaml:"targetProtocol"` // The properties required to create a new task definition. // // TaskDefinition or TaskImageOptions must be specified, but not both. // Default: none. // TaskImageOptions *ApplicationLoadBalancedTaskImageOptions `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` }
The properties for the base ApplicationLoadBalancedEc2Service or ApplicationLoadBalancedFargateService service.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var applicationLoadBalancer applicationLoadBalancer var certificate certificate var cluster cluster var containerDefinition containerDefinition var containerImage containerImage var hostedZone hostedZone var logDriver logDriver var namespace iNamespace var role role var secret secret var vpc vpc applicationLoadBalancedServiceBaseProps := &ApplicationLoadBalancedServiceBaseProps{ CapacityProviderStrategies: []capacityProviderStrategy{ &capacityProviderStrategy{ CapacityProvider: jsii.String("capacityProvider"), // the properties below are optional Base: jsii.Number(123), Weight: jsii.Number(123), }, }, Certificate: certificate, CircuitBreaker: &DeploymentCircuitBreaker{ Enable: jsii.Boolean(false), Rollback: jsii.Boolean(false), }, CloudMapOptions: &CloudMapOptions{ CloudMapNamespace: namespace, Container: containerDefinition, ContainerPort: jsii.Number(123), DnsRecordType: awscdk.Aws_servicediscovery.DnsRecordType_A, DnsTtl: cdk.Duration_Minutes(jsii.Number(30)), FailureThreshold: jsii.Number(123), Name: jsii.String("name"), }, Cluster: cluster, DeploymentController: &DeploymentController{ Type: awscdk.Aws_ecs.DeploymentControllerType_ECS, }, DesiredCount: jsii.Number(123), DomainName: jsii.String("domainName"), DomainZone: hostedZone, EnableECSManagedTags: jsii.Boolean(false), EnableExecuteCommand: jsii.Boolean(false), HealthCheckGracePeriod: cdk.Duration_*Minutes(jsii.Number(30)), IdleTimeout: cdk.Duration_*Minutes(jsii.Number(30)), IpAddressType: awscdk.Aws_elasticloadbalancingv2.IpAddressType_IPV4, ListenerPort: jsii.Number(123), LoadBalancer: applicationLoadBalancer, LoadBalancerName: jsii.String("loadBalancerName"), MaxHealthyPercent: jsii.Number(123), MinHealthyPercent: jsii.Number(123), OpenListener: jsii.Boolean(false), PropagateTags: awscdk.*Aws_ecs.PropagatedTagSource_SERVICE, Protocol: awscdk.*Aws_elasticloadbalancingv2.ApplicationProtocol_HTTP, ProtocolVersion: awscdk.*Aws_elasticloadbalancingv2.ApplicationProtocolVersion_GRPC, PublicLoadBalancer: jsii.Boolean(false), RecordType: awscdk.Aws_ecs_patterns.ApplicationLoadBalancedServiceRecordType_ALIAS, RedirectHTTP: jsii.Boolean(false), ServiceName: jsii.String("serviceName"), SslPolicy: awscdk.*Aws_elasticloadbalancingv2.SslPolicy_RECOMMENDED_TLS, TargetProtocol: awscdk.*Aws_elasticloadbalancingv2.ApplicationProtocol_HTTP, TaskImageOptions: &ApplicationLoadBalancedTaskImageOptions{ Image: containerImage, // the properties below are optional Command: []*string{ jsii.String("command"), }, ContainerName: jsii.String("containerName"), ContainerPort: jsii.Number(123), DockerLabels: map[string]*string{ "dockerLabelsKey": jsii.String("dockerLabels"), }, EnableLogging: jsii.Boolean(false), EntryPoint: []*string{ jsii.String("entryPoint"), }, Environment: map[string]*string{ "environmentKey": jsii.String("environment"), }, ExecutionRole: role, Family: jsii.String("family"), LogDriver: logDriver, Secrets: map[string]*secret{ "secretsKey": secret, }, TaskRole: role, }, Vpc: vpc, }
type ApplicationLoadBalancedServiceRecordType ¶
type ApplicationLoadBalancedServiceRecordType string
Describes the type of DNS record the service should create.
const ( // Create Route53 A Alias record. ApplicationLoadBalancedServiceRecordType_ALIAS ApplicationLoadBalancedServiceRecordType = "ALIAS" // Create a CNAME record. ApplicationLoadBalancedServiceRecordType_CNAME ApplicationLoadBalancedServiceRecordType = "CNAME" // Do not create any DNS records. ApplicationLoadBalancedServiceRecordType_NONE ApplicationLoadBalancedServiceRecordType = "NONE" )
type ApplicationLoadBalancedTaskImageOptions ¶
type ApplicationLoadBalancedTaskImageOptions struct { // The image used to start a container. // // Image or taskDefinition must be specified, not both. // Default: - none. // Image awsecs.ContainerImage `field:"required" json:"image" yaml:"image"` // The command that's passed to the container. // // If there are multiple arguments, make sure that each argument is a separated string in the array. // // This parameter maps to `Cmd` in the [Create a container](https://docs.docker.com/engine/api/v1.38/#operation/ContainerCreate) section // of the [Docker Remote API](https://docs.docker.com/engine/api/v1.38/) and the `COMMAND` parameter to // [docker run](https://docs.docker.com/engine/reference/commandline/run/). // // For more information about the Docker `CMD` parameter, see https://docs.docker.com/engine/reference/builder/#cmd. // Default: none. // Command *[]*string `field:"optional" json:"command" yaml:"command"` // The container name value to be specified in the task definition. // Default: - none. // ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` // The port number on the container that is bound to the user-specified or automatically assigned host port. // // If you are using containers in a task with the awsvpc or host network mode, exposed ports should be specified using containerPort. // If you are using containers in a task with the bridge network mode and you specify a container port and not a host port, // your container automatically receives a host port in the ephemeral port range. // // Port mappings that are automatically assigned in this way do not count toward the 100 reserved ports limit of a container instance. // // For more information, see // [hostPort](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PortMapping.html#ECS-Type-PortMapping-hostPort). // Default: 80. // ContainerPort *float64 `field:"optional" json:"containerPort" yaml:"containerPort"` // A key/value map of labels to add to the container. // Default: - No labels. // DockerLabels *map[string]*string `field:"optional" json:"dockerLabels" yaml:"dockerLabels"` // Flag to indicate whether to enable logging. // Default: true. // EnableLogging *bool `field:"optional" json:"enableLogging" yaml:"enableLogging"` // The entry point that's passed to the container. // // This parameter maps to `Entrypoint` in the [Create a container](https://docs.docker.com/engine/api/v1.38/#operation/ContainerCreate) section // of the [Docker Remote API](https://docs.docker.com/engine/api/v1.38/) and the `--entrypoint` option to // [docker run](https://docs.docker.com/engine/reference/commandline/run/). // // For more information about the Docker `ENTRYPOINT` parameter, see https://docs.docker.com/engine/reference/builder/#entrypoint. // Default: none. // EntryPoint *[]*string `field:"optional" json:"entryPoint" yaml:"entryPoint"` // The environment variables to pass to the container. // Default: - No environment variables. // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The name of the task execution IAM role that grants the Amazon ECS container agent permission to call AWS APIs on your behalf. // Default: - No value. // ExecutionRole awsiam.IRole `field:"optional" json:"executionRole" yaml:"executionRole"` // The name of a family that this task definition is registered to. // // A family groups multiple versions of a task definition. // Default: - Automatically generated name. // Family *string `field:"optional" json:"family" yaml:"family"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The secret to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` // The name of the task IAM role that grants containers in the task permission to call AWS APIs on your behalf. // Default: - A task role is automatically created for you. // TaskRole awsiam.IRole `field:"optional" json:"taskRole" yaml:"taskRole"` }
Example:
var cluster cluster loadBalancedFargateService := ecsPatterns.NewApplicationLoadBalancedFargateService(this, jsii.String("Service"), &ApplicationLoadBalancedFargateServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), DesiredCount: jsii.Number(1), Cpu: jsii.Number(512), TaskImageOptions: &ApplicationLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, TaskSubnets: &SubnetSelection{ Subnets: []iSubnet{ ec2.Subnet_FromSubnetId(this, jsii.String("subnet"), jsii.String("VpcISOLATEDSubnet1Subnet80F07FA0")), }, }, LoadBalancerName: jsii.String("application-lb-name"), })
type ApplicationLoadBalancedTaskImageProps ¶
type ApplicationLoadBalancedTaskImageProps struct { // The image used to start a container. // // Image or taskDefinition must be specified, not both. // Default: - none. // Image awsecs.ContainerImage `field:"required" json:"image" yaml:"image"` // The container name value to be specified in the task definition. // Default: - web. // ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` // A list of port numbers on the container that is bound to the user-specified or automatically assigned host port. // // If you are using containers in a task with the awsvpc or host network mode, exposed ports should be specified using containerPort. // If you are using containers in a task with the bridge network mode and you specify a container port and not a host port, // your container automatically receives a host port in the ephemeral port range. // // Port mappings that are automatically assigned in this way do not count toward the 100 reserved ports limit of a container instance. // // For more information, see // [hostPort](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PortMapping.html#ECS-Type-PortMapping-hostPort). // Default: - [80]. // ContainerPorts *[]*float64 `field:"optional" json:"containerPorts" yaml:"containerPorts"` // A key/value map of labels to add to the container. // Default: - No labels. // DockerLabels *map[string]*string `field:"optional" json:"dockerLabels" yaml:"dockerLabels"` // Flag to indicate whether to enable logging. // Default: true. // EnableLogging *bool `field:"optional" json:"enableLogging" yaml:"enableLogging"` // The environment variables to pass to the container. // Default: - No environment variables. // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The name of the task execution IAM role that grants the Amazon ECS container agent permission to call AWS APIs on your behalf. // Default: - No value. // ExecutionRole awsiam.IRole `field:"optional" json:"executionRole" yaml:"executionRole"` // The name of a family that this task definition is registered to. // // A family groups multiple versions of a task definition. // Default: - Automatically generated name. // Family *string `field:"optional" json:"family" yaml:"family"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The secrets to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` // The name of the task IAM role that grants containers in the task permission to call AWS APIs on your behalf. // Default: - A task role is automatically created for you. // TaskRole awsiam.IRole `field:"optional" json:"taskRole" yaml:"taskRole"` }
Options for configuring a new container.
Example:
import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{ MaxAzs: jsii.Number(1), }) loadBalancedFargateService := ecsPatterns.NewApplicationMultipleTargetGroupsFargateService(this, jsii.String("myService"), &ApplicationMultipleTargetGroupsFargateServiceProps{ Cluster: ecs.NewCluster(this, jsii.String("EcsCluster"), &ClusterProps{ Vpc: *Vpc, }), MemoryLimitMiB: jsii.Number(256), TaskImageOptions: &ApplicationLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, EnableExecuteCommand: jsii.Boolean(true), LoadBalancers: []applicationLoadBalancerProps{ &applicationLoadBalancerProps{ Name: jsii.String("lb"), IdleTimeout: awscdk.Duration_Seconds(jsii.Number(400)), DomainName: jsii.String("api.example.com"), DomainZone: awscdk.NewPublicHostedZone(this, jsii.String("HostedZone"), &PublicHostedZoneProps{ ZoneName: jsii.String("example.com"), }), Listeners: []applicationListenerProps{ &applicationListenerProps{ Name: jsii.String("listener"), Protocol: awscdk.ApplicationProtocol_HTTPS, Certificate: awscdk.Certificate_FromCertificateArn(this, jsii.String("Cert"), jsii.String("helloworld")), SslPolicy: awscdk.SslPolicy_TLS12_EXT, }, }, }, &applicationLoadBalancerProps{ Name: jsii.String("lb2"), IdleTimeout: awscdk.Duration_*Seconds(jsii.Number(120)), DomainName: jsii.String("frontend.com"), DomainZone: awscdk.NewPublicHostedZone(this, jsii.String("HostedZone"), &PublicHostedZoneProps{ ZoneName: jsii.String("frontend.com"), }), Listeners: []*applicationListenerProps{ &applicationListenerProps{ Name: jsii.String("listener2"), Protocol: awscdk.ApplicationProtocol_HTTPS, Certificate: awscdk.Certificate_*FromCertificateArn(this, jsii.String("Cert2"), jsii.String("helloworld")), SslPolicy: awscdk.SslPolicy_TLS12_EXT, }, }, }, }, TargetGroups: []applicationTargetProps{ &applicationTargetProps{ ContainerPort: jsii.Number(80), Listener: jsii.String("listener"), }, &applicationTargetProps{ ContainerPort: jsii.Number(90), PathPattern: jsii.String("a/b/c"), Priority: jsii.Number(10), Listener: jsii.String("listener"), }, &applicationTargetProps{ ContainerPort: jsii.Number(443), Listener: jsii.String("listener2"), }, &applicationTargetProps{ ContainerPort: jsii.Number(80), PathPattern: jsii.String("a/b/c"), Priority: jsii.Number(10), Listener: jsii.String("listener2"), }, }, })
type ApplicationLoadBalancerProps ¶
type ApplicationLoadBalancerProps struct { // Listeners (at least one listener) attached to this load balancer. Listeners *[]*ApplicationListenerProps `field:"required" json:"listeners" yaml:"listeners"` // Name of the load balancer. Name *string `field:"required" json:"name" yaml:"name"` // The domain name for the service, e.g. "api.example.com.". // Default: - No domain name. // DomainName *string `field:"optional" json:"domainName" yaml:"domainName"` // The Route53 hosted zone for the domain, e.g. "example.com.". // Default: - No Route53 hosted domain zone. // DomainZone awsroute53.IHostedZone `field:"optional" json:"domainZone" yaml:"domainZone"` // The load balancer idle timeout, in seconds. // // Can be between 1 and 4000 seconds. // Default: - CloudFormation sets idle timeout to 60 seconds. // IdleTimeout awscdk.Duration `field:"optional" json:"idleTimeout" yaml:"idleTimeout"` // Determines whether the Load Balancer will be internet-facing. // Default: true. // PublicLoadBalancer *bool `field:"optional" json:"publicLoadBalancer" yaml:"publicLoadBalancer"` }
Properties to define an application load balancer.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var certificate certificate var hostedZone hostedZone applicationLoadBalancerProps := &ApplicationLoadBalancerProps{ Listeners: []applicationListenerProps{ &applicationListenerProps{ Name: jsii.String("name"), // the properties below are optional Certificate: certificate, Port: jsii.Number(123), Protocol: awscdk.Aws_elasticloadbalancingv2.ApplicationProtocol_HTTP, SslPolicy: awscdk.*Aws_elasticloadbalancingv2.SslPolicy_RECOMMENDED_TLS, }, }, Name: jsii.String("name"), // the properties below are optional DomainName: jsii.String("domainName"), DomainZone: hostedZone, IdleTimeout: cdk.Duration_Minutes(jsii.Number(30)), PublicLoadBalancer: jsii.Boolean(false), }
type ApplicationMultipleTargetGroupsEc2Service ¶
type ApplicationMultipleTargetGroupsEc2Service interface { ApplicationMultipleTargetGroupsServiceBase // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service, if one is not provided. InternalDesiredCount() *float64 // The default listener for the service (first added listener). // Deprecated: - Use `listeners` instead. Listener() awselasticloadbalancingv2.ApplicationListener // The listeners of the service. Listeners() *[]awselasticloadbalancingv2.ApplicationListener // The default Application Load Balancer for the service (first added load balancer). // Deprecated: - Use `loadBalancers` instead. LoadBalancer() awselasticloadbalancingv2.ApplicationLoadBalancer // The load balancers of the service. LoadBalancers() *[]awselasticloadbalancingv2.ApplicationLoadBalancer LogDriver() awsecs.LogDriver SetLogDriver(val awsecs.LogDriver) // The tree node. Node() constructs.Node // The EC2 service in this construct. Service() awsecs.Ec2Service // The default target group for the service. // Deprecated: - Use `targetGroups` instead. TargetGroup() awselasticloadbalancingv2.ApplicationTargetGroup // The target groups of the service. TargetGroups() *[]awselasticloadbalancingv2.ApplicationTargetGroup // The EC2 Task Definition in this construct. TaskDefinition() awsecs.Ec2TaskDefinition AddPortMappingForTargets(container awsecs.ContainerDefinition, targets *[]*ApplicationTargetProps) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver FindListener(name *string) awselasticloadbalancingv2.ApplicationListener // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster RegisterECSTargets(service awsecs.BaseService, container awsecs.ContainerDefinition, targets *[]*ApplicationTargetProps) awselasticloadbalancingv2.ApplicationTargetGroup // Returns a string representation of this construct. ToString() *string }
An EC2 service running on an ECS cluster fronted by an application load balancer.
Example:
// One application load balancer with one listener and two target groups. var cluster cluster loadBalancedEc2Service := ecsPatterns.NewApplicationMultipleTargetGroupsEc2Service(this, jsii.String("Service"), &ApplicationMultipleTargetGroupsEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(256), TaskImageOptions: &ApplicationLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, TargetGroups: []applicationTargetProps{ &applicationTargetProps{ ContainerPort: jsii.Number(80), }, &applicationTargetProps{ ContainerPort: jsii.Number(90), PathPattern: jsii.String("a/b/c"), Priority: jsii.Number(10), }, }, })
func NewApplicationMultipleTargetGroupsEc2Service ¶
func NewApplicationMultipleTargetGroupsEc2Service(scope constructs.Construct, id *string, props *ApplicationMultipleTargetGroupsEc2ServiceProps) ApplicationMultipleTargetGroupsEc2Service
Constructs a new instance of the ApplicationMultipleTargetGroupsEc2Service class.
type ApplicationMultipleTargetGroupsEc2ServiceProps ¶
type ApplicationMultipleTargetGroupsEc2ServiceProps struct { // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The desired number of instantiations of the task definition to keep running on the service. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The application load balancer that will serve traffic to the service. // Default: - a new load balancer with a listener will be created. // LoadBalancers *[]*ApplicationLoadBalancerProps `field:"optional" json:"loadBalancers" yaml:"loadBalancers"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // Properties to specify ALB target groups. // Default: - default portMapping registered as target group and attached to the first defined listener. // TargetGroups *[]*ApplicationTargetProps `field:"optional" json:"targetGroups" yaml:"targetGroups"` // The properties required to create a new task definition. // // Only one of TaskDefinition or TaskImageOptions must be specified. // Default: none. // TaskImageOptions *ApplicationLoadBalancedTaskImageProps `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The minimum number of CPU units to reserve for the container. // // Valid values, which determines your range of valid values for the memory parameter:. // Default: - No minimum CPU units reserved. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in MiB) of memory to present to the container. // // If your container attempts to exceed the allocated memory, the container // is terminated. // // At least one of memoryLimitMiB and memoryReservationMiB is required. // Default: - No memory limit. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // The soft limit (in MiB) of memory to reserve for the container. // // When system memory is under heavy contention, Docker attempts to keep the // container memory to this soft limit. However, your container can consume more // memory when it needs to, up to either the hard limit specified with the memory // parameter (if applicable), or all of the available memory on the container // instance, whichever comes first. // // At least one of memoryLimitMiB and memoryReservationMiB is required. // // Note that this setting will be ignored if TaskImagesOptions is specified. // Default: - No memory reserved. // MemoryReservationMiB *float64 `field:"optional" json:"memoryReservationMiB" yaml:"memoryReservationMiB"` // The placement constraints to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html). // Default: - No constraints. // PlacementConstraints *[]awsecs.PlacementConstraint `field:"optional" json:"placementConstraints" yaml:"placementConstraints"` // The placement strategies to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html). // Default: - No strategies. // PlacementStrategies *[]awsecs.PlacementStrategy `field:"optional" json:"placementStrategies" yaml:"placementStrategies"` // The task definition to use for tasks in the service. Only one of TaskDefinition or TaskImageOptions must be specified. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.Ec2TaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` }
The properties for the ApplicationMultipleTargetGroupsEc2Service service.
Example:
// One application load balancer with one listener and two target groups. var cluster cluster loadBalancedEc2Service := ecsPatterns.NewApplicationMultipleTargetGroupsEc2Service(this, jsii.String("Service"), &ApplicationMultipleTargetGroupsEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(256), TaskImageOptions: &ApplicationLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, TargetGroups: []applicationTargetProps{ &applicationTargetProps{ ContainerPort: jsii.Number(80), }, &applicationTargetProps{ ContainerPort: jsii.Number(90), PathPattern: jsii.String("a/b/c"), Priority: jsii.Number(10), }, }, })
type ApplicationMultipleTargetGroupsFargateService ¶
type ApplicationMultipleTargetGroupsFargateService interface { ApplicationMultipleTargetGroupsServiceBase // Determines whether the service will be assigned a public IP address. AssignPublicIp() *bool // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service, if one is not provided. InternalDesiredCount() *float64 // The default listener for the service (first added listener). // Deprecated: - Use `listeners` instead. Listener() awselasticloadbalancingv2.ApplicationListener // The listeners of the service. Listeners() *[]awselasticloadbalancingv2.ApplicationListener // The default Application Load Balancer for the service (first added load balancer). // Deprecated: - Use `loadBalancers` instead. LoadBalancer() awselasticloadbalancingv2.ApplicationLoadBalancer // The load balancers of the service. LoadBalancers() *[]awselasticloadbalancingv2.ApplicationLoadBalancer LogDriver() awsecs.LogDriver SetLogDriver(val awsecs.LogDriver) // The tree node. Node() constructs.Node // The Fargate service in this construct. Service() awsecs.FargateService // The default target group for the service. // Deprecated: - Use `targetGroups` instead. TargetGroup() awselasticloadbalancingv2.ApplicationTargetGroup // The target groups of the service. TargetGroups() *[]awselasticloadbalancingv2.ApplicationTargetGroup // The Fargate task definition in this construct. TaskDefinition() awsecs.FargateTaskDefinition AddPortMappingForTargets(container awsecs.ContainerDefinition, targets *[]*ApplicationTargetProps) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver FindListener(name *string) awselasticloadbalancingv2.ApplicationListener // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster RegisterECSTargets(service awsecs.BaseService, container awsecs.ContainerDefinition, targets *[]*ApplicationTargetProps) awselasticloadbalancingv2.ApplicationTargetGroup // Returns a string representation of this construct. ToString() *string }
A Fargate service running on an ECS cluster fronted by an application load balancer.
Example:
import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{ MaxAzs: jsii.Number(1), }) loadBalancedFargateService := ecsPatterns.NewApplicationMultipleTargetGroupsFargateService(this, jsii.String("myService"), &ApplicationMultipleTargetGroupsFargateServiceProps{ Cluster: ecs.NewCluster(this, jsii.String("EcsCluster"), &ClusterProps{ Vpc: *Vpc, }), MemoryLimitMiB: jsii.Number(256), TaskImageOptions: &ApplicationLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, EnableExecuteCommand: jsii.Boolean(true), LoadBalancers: []applicationLoadBalancerProps{ &applicationLoadBalancerProps{ Name: jsii.String("lb"), IdleTimeout: awscdk.Duration_Seconds(jsii.Number(400)), DomainName: jsii.String("api.example.com"), DomainZone: awscdk.NewPublicHostedZone(this, jsii.String("HostedZone"), &PublicHostedZoneProps{ ZoneName: jsii.String("example.com"), }), Listeners: []applicationListenerProps{ &applicationListenerProps{ Name: jsii.String("listener"), Protocol: awscdk.ApplicationProtocol_HTTPS, Certificate: awscdk.Certificate_FromCertificateArn(this, jsii.String("Cert"), jsii.String("helloworld")), SslPolicy: awscdk.SslPolicy_TLS12_EXT, }, }, }, &applicationLoadBalancerProps{ Name: jsii.String("lb2"), IdleTimeout: awscdk.Duration_*Seconds(jsii.Number(120)), DomainName: jsii.String("frontend.com"), DomainZone: awscdk.NewPublicHostedZone(this, jsii.String("HostedZone"), &PublicHostedZoneProps{ ZoneName: jsii.String("frontend.com"), }), Listeners: []*applicationListenerProps{ &applicationListenerProps{ Name: jsii.String("listener2"), Protocol: awscdk.ApplicationProtocol_HTTPS, Certificate: awscdk.Certificate_*FromCertificateArn(this, jsii.String("Cert2"), jsii.String("helloworld")), SslPolicy: awscdk.SslPolicy_TLS12_EXT, }, }, }, }, TargetGroups: []applicationTargetProps{ &applicationTargetProps{ ContainerPort: jsii.Number(80), Listener: jsii.String("listener"), }, &applicationTargetProps{ ContainerPort: jsii.Number(90), PathPattern: jsii.String("a/b/c"), Priority: jsii.Number(10), Listener: jsii.String("listener"), }, &applicationTargetProps{ ContainerPort: jsii.Number(443), Listener: jsii.String("listener2"), }, &applicationTargetProps{ ContainerPort: jsii.Number(80), PathPattern: jsii.String("a/b/c"), Priority: jsii.Number(10), Listener: jsii.String("listener2"), }, }, })
func NewApplicationMultipleTargetGroupsFargateService ¶
func NewApplicationMultipleTargetGroupsFargateService(scope constructs.Construct, id *string, props *ApplicationMultipleTargetGroupsFargateServiceProps) ApplicationMultipleTargetGroupsFargateService
Constructs a new instance of the ApplicationMultipleTargetGroupsFargateService class.
type ApplicationMultipleTargetGroupsFargateServiceProps ¶
type ApplicationMultipleTargetGroupsFargateServiceProps struct { // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The desired number of instantiations of the task definition to keep running on the service. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The application load balancer that will serve traffic to the service. // Default: - a new load balancer with a listener will be created. // LoadBalancers *[]*ApplicationLoadBalancerProps `field:"optional" json:"loadBalancers" yaml:"loadBalancers"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // Properties to specify ALB target groups. // Default: - default portMapping registered as target group and attached to the first defined listener. // TargetGroups *[]*ApplicationTargetProps `field:"optional" json:"targetGroups" yaml:"targetGroups"` // The properties required to create a new task definition. // // Only one of TaskDefinition or TaskImageOptions must be specified. // Default: none. // TaskImageOptions *ApplicationLoadBalancedTaskImageProps `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments // // 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: 256. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in GiB) of ephemeral storage to be allocated to the task. // // The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. // // Only supported in Fargate platform version 1.4.0 or later. // Default: Undefined, in which case, the task will receive 20GiB ephemeral storage. // EphemeralStorageGiB *float64 `field:"optional" json:"ephemeralStorageGiB" yaml:"ephemeralStorageGiB"` // The amount (in MiB) of memory used by the task. // // This field is required and you must use one of the following values, which determines your range of valid values // for the cpu parameter: // // 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) // // 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) // // 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) // // Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) // // Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) // // Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) // // Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) // // This default is set in the underlying FargateTaskDefinition construct. // Default: 512. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // 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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) // in the Amazon Elastic Container Service Developer Guide. // Default: Latest. // PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // The runtime platform of the task definition. // Default: - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64. // RuntimePlatform *awsecs.RuntimePlatform `field:"optional" json:"runtimePlatform" yaml:"runtimePlatform"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.FargateTaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` // Determines whether the service will be assigned a public IP address. // Default: false. // AssignPublicIp *bool `field:"optional" json:"assignPublicIp" yaml:"assignPublicIp"` }
The properties for the ApplicationMultipleTargetGroupsFargateService service.
Example:
import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{ MaxAzs: jsii.Number(1), }) loadBalancedFargateService := ecsPatterns.NewApplicationMultipleTargetGroupsFargateService(this, jsii.String("myService"), &ApplicationMultipleTargetGroupsFargateServiceProps{ Cluster: ecs.NewCluster(this, jsii.String("EcsCluster"), &ClusterProps{ Vpc: *Vpc, }), MemoryLimitMiB: jsii.Number(256), TaskImageOptions: &ApplicationLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, EnableExecuteCommand: jsii.Boolean(true), LoadBalancers: []applicationLoadBalancerProps{ &applicationLoadBalancerProps{ Name: jsii.String("lb"), IdleTimeout: awscdk.Duration_Seconds(jsii.Number(400)), DomainName: jsii.String("api.example.com"), DomainZone: awscdk.NewPublicHostedZone(this, jsii.String("HostedZone"), &PublicHostedZoneProps{ ZoneName: jsii.String("example.com"), }), Listeners: []applicationListenerProps{ &applicationListenerProps{ Name: jsii.String("listener"), Protocol: awscdk.ApplicationProtocol_HTTPS, Certificate: awscdk.Certificate_FromCertificateArn(this, jsii.String("Cert"), jsii.String("helloworld")), SslPolicy: awscdk.SslPolicy_TLS12_EXT, }, }, }, &applicationLoadBalancerProps{ Name: jsii.String("lb2"), IdleTimeout: awscdk.Duration_*Seconds(jsii.Number(120)), DomainName: jsii.String("frontend.com"), DomainZone: awscdk.NewPublicHostedZone(this, jsii.String("HostedZone"), &PublicHostedZoneProps{ ZoneName: jsii.String("frontend.com"), }), Listeners: []*applicationListenerProps{ &applicationListenerProps{ Name: jsii.String("listener2"), Protocol: awscdk.ApplicationProtocol_HTTPS, Certificate: awscdk.Certificate_*FromCertificateArn(this, jsii.String("Cert2"), jsii.String("helloworld")), SslPolicy: awscdk.SslPolicy_TLS12_EXT, }, }, }, }, TargetGroups: []applicationTargetProps{ &applicationTargetProps{ ContainerPort: jsii.Number(80), Listener: jsii.String("listener"), }, &applicationTargetProps{ ContainerPort: jsii.Number(90), PathPattern: jsii.String("a/b/c"), Priority: jsii.Number(10), Listener: jsii.String("listener"), }, &applicationTargetProps{ ContainerPort: jsii.Number(443), Listener: jsii.String("listener2"), }, &applicationTargetProps{ ContainerPort: jsii.Number(80), PathPattern: jsii.String("a/b/c"), Priority: jsii.Number(10), Listener: jsii.String("listener2"), }, }, })
type ApplicationMultipleTargetGroupsServiceBase ¶
type ApplicationMultipleTargetGroupsServiceBase interface { constructs.Construct // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service, if one is not provided. InternalDesiredCount() *float64 // The default listener for the service (first added listener). // Deprecated: - Use `listeners` instead. Listener() awselasticloadbalancingv2.ApplicationListener // The listeners of the service. Listeners() *[]awselasticloadbalancingv2.ApplicationListener // The default Application Load Balancer for the service (first added load balancer). // Deprecated: - Use `loadBalancers` instead. LoadBalancer() awselasticloadbalancingv2.ApplicationLoadBalancer // The load balancers of the service. LoadBalancers() *[]awselasticloadbalancingv2.ApplicationLoadBalancer LogDriver() awsecs.LogDriver SetLogDriver(val awsecs.LogDriver) // The tree node. Node() constructs.Node // The target groups of the service. TargetGroups() *[]awselasticloadbalancingv2.ApplicationTargetGroup AddPortMappingForTargets(container awsecs.ContainerDefinition, targets *[]*ApplicationTargetProps) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver FindListener(name *string) awselasticloadbalancingv2.ApplicationListener // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster RegisterECSTargets(service awsecs.BaseService, container awsecs.ContainerDefinition, targets *[]*ApplicationTargetProps) awselasticloadbalancingv2.ApplicationTargetGroup // Returns a string representation of this construct. ToString() *string }
The base class for ApplicationMultipleTargetGroupsEc2Service and ApplicationMultipleTargetGroupsFargateService classes.
type ApplicationMultipleTargetGroupsServiceBaseProps ¶
type ApplicationMultipleTargetGroupsServiceBaseProps struct { // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The desired number of instantiations of the task definition to keep running on the service. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The application load balancer that will serve traffic to the service. // Default: - a new load balancer with a listener will be created. // LoadBalancers *[]*ApplicationLoadBalancerProps `field:"optional" json:"loadBalancers" yaml:"loadBalancers"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // Properties to specify ALB target groups. // Default: - default portMapping registered as target group and attached to the first defined listener. // TargetGroups *[]*ApplicationTargetProps `field:"optional" json:"targetGroups" yaml:"targetGroups"` // The properties required to create a new task definition. // // Only one of TaskDefinition or TaskImageOptions must be specified. // Default: none. // TaskImageOptions *ApplicationLoadBalancedTaskImageProps `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` }
The properties for the base ApplicationMultipleTargetGroupsEc2Service or ApplicationMultipleTargetGroupsFargateService service.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var certificate certificate var cluster cluster var containerDefinition containerDefinition var containerImage containerImage var hostedZone hostedZone var logDriver logDriver var namespace iNamespace var role role var secret secret var vpc vpc applicationMultipleTargetGroupsServiceBaseProps := &ApplicationMultipleTargetGroupsServiceBaseProps{ CloudMapOptions: &CloudMapOptions{ CloudMapNamespace: namespace, Container: containerDefinition, ContainerPort: jsii.Number(123), DnsRecordType: awscdk.Aws_servicediscovery.DnsRecordType_A, DnsTtl: cdk.Duration_Minutes(jsii.Number(30)), FailureThreshold: jsii.Number(123), Name: jsii.String("name"), }, Cluster: cluster, DesiredCount: jsii.Number(123), EnableECSManagedTags: jsii.Boolean(false), EnableExecuteCommand: jsii.Boolean(false), HealthCheckGracePeriod: cdk.Duration_*Minutes(jsii.Number(30)), LoadBalancers: []applicationLoadBalancerProps{ &applicationLoadBalancerProps{ Listeners: []applicationListenerProps{ &applicationListenerProps{ Name: jsii.String("name"), // the properties below are optional Certificate: certificate, Port: jsii.Number(123), Protocol: awscdk.Aws_elasticloadbalancingv2.ApplicationProtocol_HTTP, SslPolicy: awscdk.*Aws_elasticloadbalancingv2.SslPolicy_RECOMMENDED_TLS, }, }, Name: jsii.String("name"), // the properties below are optional DomainName: jsii.String("domainName"), DomainZone: hostedZone, IdleTimeout: cdk.Duration_*Minutes(jsii.Number(30)), PublicLoadBalancer: jsii.Boolean(false), }, }, PropagateTags: awscdk.Aws_ecs.PropagatedTagSource_SERVICE, ServiceName: jsii.String("serviceName"), TargetGroups: []applicationTargetProps{ &applicationTargetProps{ ContainerPort: jsii.Number(123), // the properties below are optional HostHeader: jsii.String("hostHeader"), Listener: jsii.String("listener"), PathPattern: jsii.String("pathPattern"), Priority: jsii.Number(123), Protocol: awscdk.*Aws_ecs.Protocol_TCP, }, }, TaskImageOptions: &ApplicationLoadBalancedTaskImageProps{ Image: containerImage, // the properties below are optional ContainerName: jsii.String("containerName"), ContainerPorts: []*f64{ jsii.Number(123), }, DockerLabels: map[string]*string{ "dockerLabelsKey": jsii.String("dockerLabels"), }, EnableLogging: jsii.Boolean(false), Environment: map[string]*string{ "environmentKey": jsii.String("environment"), }, ExecutionRole: role, Family: jsii.String("family"), LogDriver: logDriver, Secrets: map[string]*secret{ "secretsKey": secret, }, TaskRole: role, }, Vpc: vpc, }
type ApplicationTargetProps ¶
type ApplicationTargetProps struct { // The port number of the container. // // Only applicable when using application/network load balancers. ContainerPort *float64 `field:"required" json:"containerPort" yaml:"containerPort"` // Rule applies if the requested host matches the indicated host. // // May contain up to three '*' wildcards. // // Requires that priority is set. // See: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#host-conditions // // Default: No host condition. // HostHeader *string `field:"optional" json:"hostHeader" yaml:"hostHeader"` // Name of the listener the target group attached to. // Default: - default listener (first added listener). // Listener *string `field:"optional" json:"listener" yaml:"listener"` // Rule applies if the requested path matches the given path pattern. // // May contain up to three '*' wildcards. // // Requires that priority is set. // See: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#path-conditions // // Default: No path condition. // PathPattern *string `field:"optional" json:"pathPattern" yaml:"pathPattern"` // Priority of this target group. // // The rule with the lowest priority will be used for every request. // If priority is not given, these target groups will be added as // defaults, and must not have conditions. // // Priorities must be unique. // Default: Target groups are used as defaults. // Priority *float64 `field:"optional" json:"priority" yaml:"priority"` // The protocol used for the port mapping. // // Only applicable when using application load balancers. // Default: ecs.Protocol.TCP // Protocol awsecs.Protocol `field:"optional" json:"protocol" yaml:"protocol"` }
Properties to define an application target group.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" applicationTargetProps := &ApplicationTargetProps{ ContainerPort: jsii.Number(123), // the properties below are optional HostHeader: jsii.String("hostHeader"), Listener: jsii.String("listener"), PathPattern: jsii.String("pathPattern"), Priority: jsii.Number(123), Protocol: awscdk.Aws_ecs.Protocol_TCP, }
type FargateServiceBaseProps ¶ added in v2.38.0
type FargateServiceBaseProps struct { // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments // // 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: 256. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in GiB) of ephemeral storage to be allocated to the task. // // The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. // // Only supported in Fargate platform version 1.4.0 or later. // Default: Undefined, in which case, the task will receive 20GiB ephemeral storage. // EphemeralStorageGiB *float64 `field:"optional" json:"ephemeralStorageGiB" yaml:"ephemeralStorageGiB"` // The amount (in MiB) of memory used by the task. // // This field is required and you must use one of the following values, which determines your range of valid values // for the cpu parameter: // // 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) // // 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) // // 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) // // Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) // // Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) // // Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) // // Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) // // This default is set in the underlying FargateTaskDefinition construct. // Default: 512. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // 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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) // in the Amazon Elastic Container Service Developer Guide. // Default: Latest. // PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // The runtime platform of the task definition. // Default: - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64. // RuntimePlatform *awsecs.RuntimePlatform `field:"optional" json:"runtimePlatform" yaml:"runtimePlatform"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.FargateTaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` }
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var cpuArchitecture cpuArchitecture var fargateTaskDefinition fargateTaskDefinition var operatingSystemFamily operatingSystemFamily fargateServiceBaseProps := &FargateServiceBaseProps{ Cpu: jsii.Number(123), EphemeralStorageGiB: jsii.Number(123), MemoryLimitMiB: jsii.Number(123), PlatformVersion: awscdk.Aws_ecs.FargatePlatformVersion_LATEST, RuntimePlatform: &RuntimePlatform{ CpuArchitecture: cpuArchitecture, OperatingSystemFamily: operatingSystemFamily, }, TaskDefinition: fargateTaskDefinition, }
type NetworkListenerProps ¶
type NetworkListenerProps struct { // Name of the listener. Name *string `field:"required" json:"name" yaml:"name"` // The port on which the listener listens for requests. // Default: 80. // Port *float64 `field:"optional" json:"port" yaml:"port"` }
Properties to define an network listener.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" networkListenerProps := &NetworkListenerProps{ Name: jsii.String("name"), // the properties below are optional Port: jsii.Number(123), }
type NetworkLoadBalancedEc2Service ¶
type NetworkLoadBalancedEc2Service interface { NetworkLoadBalancedServiceBase // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service, if one is not provided. InternalDesiredCount() *float64 // The listener for the service. Listener() awselasticloadbalancingv2.NetworkListener // The Network Load Balancer for the service. LoadBalancer() awselasticloadbalancingv2.NetworkLoadBalancer // The tree node. Node() constructs.Node // The ECS service in this construct. Service() awsecs.Ec2Service // The target group for the service. TargetGroup() awselasticloadbalancingv2.NetworkTargetGroup // The EC2 Task Definition in this construct. TaskDefinition() awsecs.Ec2TaskDefinition // Adds service as a target of the target group. AddServiceAsTarget(service awsecs.BaseService) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Returns a string representation of this construct. ToString() *string }
An EC2 service running on an ECS cluster fronted by a network load balancer.
Example:
var cluster cluster loadBalancedEcsService := ecsPatterns.NewNetworkLoadBalancedEc2Service(this, jsii.String("Service"), &NetworkLoadBalancedEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), TaskImageOptions: &NetworkLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("test")), Environment: map[string]*string{ "TEST_ENVIRONMENT_VARIABLE1": jsii.String("test environment variable 1 value"), "TEST_ENVIRONMENT_VARIABLE2": jsii.String("test environment variable 2 value"), }, }, DesiredCount: jsii.Number(2), })
func NewNetworkLoadBalancedEc2Service ¶
func NewNetworkLoadBalancedEc2Service(scope constructs.Construct, id *string, props *NetworkLoadBalancedEc2ServiceProps) NetworkLoadBalancedEc2Service
Constructs a new instance of the NetworkLoadBalancedEc2Service class.
type NetworkLoadBalancedEc2ServiceProps ¶
type NetworkLoadBalancedEc2ServiceProps struct { // A list of Capacity Provider strategies used to place a service. // Default: - undefined. // CapacityProviderStrategies *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. // Default: - disabled. // CircuitBreaker *awsecs.DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) // Default: - Rolling update (ECS). // DeploymentController *awsecs.DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // The domain name for the service, e.g. "api.example.com.". // Default: - No domain name. // DomainName *string `field:"optional" json:"domainName" yaml:"domainName"` // The Route53 hosted zone for the domain, e.g. "example.com.". // Default: - No Route53 hosted domain zone. // DomainZone awsroute53.IHostedZone `field:"optional" json:"domainZone" yaml:"domainZone"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The type of IP addresses to use. // // If you want to add a UDP or TCP_UDP listener to the load balancer, // you must choose IPv4. // See: https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-ip-address-type.html // // Default: IpAddressType.IPV4 // IpAddressType awselasticloadbalancingv2.IpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"` // Listener port of the network load balancer that will serve traffic to the service. // Default: 80. // ListenerPort *float64 `field:"optional" json:"listenerPort" yaml:"listenerPort"` // The network load balancer that will serve traffic to the service. // // If the load balancer has been imported, the vpc attribute must be specified // in the call to fromNetworkLoadBalancerAttributes(). // // [disable-awslint:ref-via-interface]. // Default: - a new load balancer will be created. // LoadBalancer awselasticloadbalancingv2.INetworkLoadBalancer `field:"optional" json:"loadBalancer" yaml:"loadBalancer"` // The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. // Default: - 100 if daemon, otherwise 200. // MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. // Default: - 0 if daemon, otherwise 50. // MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // Determines whether the Load Balancer will be internet-facing. // Default: true. // PublicLoadBalancer *bool `field:"optional" json:"publicLoadBalancer" yaml:"publicLoadBalancer"` // Specifies whether the Route53 record should be a CNAME, an A record using the Alias feature or no record at all. // // This is useful if you need to work with DNS systems that do not support alias records. // Default: NetworkLoadBalancedServiceRecordType.ALIAS // RecordType NetworkLoadBalancedServiceRecordType `field:"optional" json:"recordType" yaml:"recordType"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // The properties required to create a new task definition. // // One of taskImageOptions or taskDefinition must be specified. // Default: - none. // TaskImageOptions *NetworkLoadBalancedTaskImageOptions `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: none. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The hard limit (in MiB) of memory to present to the container. // // If your container attempts to exceed the allocated memory, the container // is terminated. // // At least one of memoryLimitMiB and memoryReservationMiB is required. // Default: - No memory limit. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // The soft limit (in MiB) of memory to reserve for the container. // // When system memory is under contention, Docker attempts to keep the // container memory within the limit. If the container requires more memory, // it can consume up to the value specified by the Memory property or all of // the available memory on the container instance—whichever comes first. // // At least one of memoryLimitMiB and memoryReservationMiB is required. // Default: - No memory reserved. // MemoryReservationMiB *float64 `field:"optional" json:"memoryReservationMiB" yaml:"memoryReservationMiB"` // The placement constraints to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html). // Default: - No constraints. // PlacementConstraints *[]awsecs.PlacementConstraint `field:"optional" json:"placementConstraints" yaml:"placementConstraints"` // The placement strategies to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html). // Default: - No strategies. // PlacementStrategies *[]awsecs.PlacementStrategy `field:"optional" json:"placementStrategies" yaml:"placementStrategies"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both.. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.Ec2TaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` }
The properties for the NetworkLoadBalancedEc2Service service.
Example:
var cluster cluster loadBalancedEcsService := ecsPatterns.NewNetworkLoadBalancedEc2Service(this, jsii.String("Service"), &NetworkLoadBalancedEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), TaskImageOptions: &NetworkLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("test")), Environment: map[string]*string{ "TEST_ENVIRONMENT_VARIABLE1": jsii.String("test environment variable 1 value"), "TEST_ENVIRONMENT_VARIABLE2": jsii.String("test environment variable 2 value"), }, }, DesiredCount: jsii.Number(2), })
type NetworkLoadBalancedFargateService ¶
type NetworkLoadBalancedFargateService interface { NetworkLoadBalancedServiceBase AssignPublicIp() *bool // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service, if one is not provided. InternalDesiredCount() *float64 // The listener for the service. Listener() awselasticloadbalancingv2.NetworkListener // The Network Load Balancer for the service. LoadBalancer() awselasticloadbalancingv2.NetworkLoadBalancer // The tree node. Node() constructs.Node // The Fargate service in this construct. Service() awsecs.FargateService // The target group for the service. TargetGroup() awselasticloadbalancingv2.NetworkTargetGroup // The Fargate task definition in this construct. TaskDefinition() awsecs.FargateTaskDefinition // Adds service as a target of the target group. AddServiceAsTarget(service awsecs.BaseService) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Returns a string representation of this construct. ToString() *string }
A Fargate service running on an ECS cluster fronted by a network load balancer.
Example:
var vpc vpc var securityGroup securityGroup queueProcessingFargateService := ecsPatterns.NewNetworkLoadBalancedFargateService(this, jsii.String("Service"), &NetworkLoadBalancedFargateServiceProps{ Vpc: Vpc, MemoryLimitMiB: jsii.Number(512), TaskImageOptions: &NetworkLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, SecurityGroups: []iSecurityGroup{ securityGroup, }, })
func NewNetworkLoadBalancedFargateService ¶
func NewNetworkLoadBalancedFargateService(scope constructs.Construct, id *string, props *NetworkLoadBalancedFargateServiceProps) NetworkLoadBalancedFargateService
Constructs a new instance of the NetworkLoadBalancedFargateService class.
type NetworkLoadBalancedFargateServiceProps ¶
type NetworkLoadBalancedFargateServiceProps struct { // A list of Capacity Provider strategies used to place a service. // Default: - undefined. // CapacityProviderStrategies *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. // Default: - disabled. // CircuitBreaker *awsecs.DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) // Default: - Rolling update (ECS). // DeploymentController *awsecs.DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // The domain name for the service, e.g. "api.example.com.". // Default: - No domain name. // DomainName *string `field:"optional" json:"domainName" yaml:"domainName"` // The Route53 hosted zone for the domain, e.g. "example.com.". // Default: - No Route53 hosted domain zone. // DomainZone awsroute53.IHostedZone `field:"optional" json:"domainZone" yaml:"domainZone"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The type of IP addresses to use. // // If you want to add a UDP or TCP_UDP listener to the load balancer, // you must choose IPv4. // See: https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-ip-address-type.html // // Default: IpAddressType.IPV4 // IpAddressType awselasticloadbalancingv2.IpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"` // Listener port of the network load balancer that will serve traffic to the service. // Default: 80. // ListenerPort *float64 `field:"optional" json:"listenerPort" yaml:"listenerPort"` // The network load balancer that will serve traffic to the service. // // If the load balancer has been imported, the vpc attribute must be specified // in the call to fromNetworkLoadBalancerAttributes(). // // [disable-awslint:ref-via-interface]. // Default: - a new load balancer will be created. // LoadBalancer awselasticloadbalancingv2.INetworkLoadBalancer `field:"optional" json:"loadBalancer" yaml:"loadBalancer"` // The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. // Default: - 100 if daemon, otherwise 200. // MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. // Default: - 0 if daemon, otherwise 50. // MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // Determines whether the Load Balancer will be internet-facing. // Default: true. // PublicLoadBalancer *bool `field:"optional" json:"publicLoadBalancer" yaml:"publicLoadBalancer"` // Specifies whether the Route53 record should be a CNAME, an A record using the Alias feature or no record at all. // // This is useful if you need to work with DNS systems that do not support alias records. // Default: NetworkLoadBalancedServiceRecordType.ALIAS // RecordType NetworkLoadBalancedServiceRecordType `field:"optional" json:"recordType" yaml:"recordType"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // The properties required to create a new task definition. // // One of taskImageOptions or taskDefinition must be specified. // Default: - none. // TaskImageOptions *NetworkLoadBalancedTaskImageOptions `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments // // 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: 256. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in GiB) of ephemeral storage to be allocated to the task. // // The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. // // Only supported in Fargate platform version 1.4.0 or later. // Default: Undefined, in which case, the task will receive 20GiB ephemeral storage. // EphemeralStorageGiB *float64 `field:"optional" json:"ephemeralStorageGiB" yaml:"ephemeralStorageGiB"` // The amount (in MiB) of memory used by the task. // // This field is required and you must use one of the following values, which determines your range of valid values // for the cpu parameter: // // 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) // // 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) // // 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) // // Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) // // Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) // // Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) // // Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) // // This default is set in the underlying FargateTaskDefinition construct. // Default: 512. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // 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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) // in the Amazon Elastic Container Service Developer Guide. // Default: Latest. // PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // The runtime platform of the task definition. // Default: - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64. // RuntimePlatform *awsecs.RuntimePlatform `field:"optional" json:"runtimePlatform" yaml:"runtimePlatform"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.FargateTaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` // Determines whether the service will be assigned a public IP address. // Default: false. // AssignPublicIp *bool `field:"optional" json:"assignPublicIp" yaml:"assignPublicIp"` // 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. // SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // 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. // TaskSubnets *awsec2.SubnetSelection `field:"optional" json:"taskSubnets" yaml:"taskSubnets"` }
The properties for the NetworkLoadBalancedFargateService service.
Example:
var vpc vpc var securityGroup securityGroup queueProcessingFargateService := ecsPatterns.NewNetworkLoadBalancedFargateService(this, jsii.String("Service"), &NetworkLoadBalancedFargateServiceProps{ Vpc: Vpc, MemoryLimitMiB: jsii.Number(512), TaskImageOptions: &NetworkLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, SecurityGroups: []iSecurityGroup{ securityGroup, }, })
type NetworkLoadBalancedServiceBase ¶
type NetworkLoadBalancedServiceBase interface { constructs.Construct // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service, if one is not provided. InternalDesiredCount() *float64 // The listener for the service. Listener() awselasticloadbalancingv2.NetworkListener // The Network Load Balancer for the service. LoadBalancer() awselasticloadbalancingv2.NetworkLoadBalancer // The tree node. Node() constructs.Node // The target group for the service. TargetGroup() awselasticloadbalancingv2.NetworkTargetGroup // Adds service as a target of the target group. AddServiceAsTarget(service awsecs.BaseService) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Returns a string representation of this construct. ToString() *string }
The base class for NetworkLoadBalancedEc2Service and NetworkLoadBalancedFargateService services.
type NetworkLoadBalancedServiceBaseProps ¶
type NetworkLoadBalancedServiceBaseProps struct { // A list of Capacity Provider strategies used to place a service. // Default: - undefined. // CapacityProviderStrategies *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. // Default: - disabled. // CircuitBreaker *awsecs.DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) // Default: - Rolling update (ECS). // DeploymentController *awsecs.DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // The domain name for the service, e.g. "api.example.com.". // Default: - No domain name. // DomainName *string `field:"optional" json:"domainName" yaml:"domainName"` // The Route53 hosted zone for the domain, e.g. "example.com.". // Default: - No Route53 hosted domain zone. // DomainZone awsroute53.IHostedZone `field:"optional" json:"domainZone" yaml:"domainZone"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The type of IP addresses to use. // // If you want to add a UDP or TCP_UDP listener to the load balancer, // you must choose IPv4. // See: https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-ip-address-type.html // // Default: IpAddressType.IPV4 // IpAddressType awselasticloadbalancingv2.IpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"` // Listener port of the network load balancer that will serve traffic to the service. // Default: 80. // ListenerPort *float64 `field:"optional" json:"listenerPort" yaml:"listenerPort"` // The network load balancer that will serve traffic to the service. // // If the load balancer has been imported, the vpc attribute must be specified // in the call to fromNetworkLoadBalancerAttributes(). // // [disable-awslint:ref-via-interface]. // Default: - a new load balancer will be created. // LoadBalancer awselasticloadbalancingv2.INetworkLoadBalancer `field:"optional" json:"loadBalancer" yaml:"loadBalancer"` // The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. // Default: - 100 if daemon, otherwise 200. // MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. // Default: - 0 if daemon, otherwise 50. // MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // Determines whether the Load Balancer will be internet-facing. // Default: true. // PublicLoadBalancer *bool `field:"optional" json:"publicLoadBalancer" yaml:"publicLoadBalancer"` // Specifies whether the Route53 record should be a CNAME, an A record using the Alias feature or no record at all. // // This is useful if you need to work with DNS systems that do not support alias records. // Default: NetworkLoadBalancedServiceRecordType.ALIAS // RecordType NetworkLoadBalancedServiceRecordType `field:"optional" json:"recordType" yaml:"recordType"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // The properties required to create a new task definition. // // One of taskImageOptions or taskDefinition must be specified. // Default: - none. // TaskImageOptions *NetworkLoadBalancedTaskImageOptions `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` }
The properties for the base NetworkLoadBalancedEc2Service or NetworkLoadBalancedFargateService service.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var cluster cluster var containerDefinition containerDefinition var containerImage containerImage var hostedZone hostedZone var logDriver logDriver var namespace iNamespace var networkLoadBalancer networkLoadBalancer var role role var secret secret var vpc vpc networkLoadBalancedServiceBaseProps := &NetworkLoadBalancedServiceBaseProps{ CapacityProviderStrategies: []capacityProviderStrategy{ &capacityProviderStrategy{ CapacityProvider: jsii.String("capacityProvider"), // the properties below are optional Base: jsii.Number(123), Weight: jsii.Number(123), }, }, CircuitBreaker: &DeploymentCircuitBreaker{ Enable: jsii.Boolean(false), Rollback: jsii.Boolean(false), }, CloudMapOptions: &CloudMapOptions{ CloudMapNamespace: namespace, Container: containerDefinition, ContainerPort: jsii.Number(123), DnsRecordType: awscdk.Aws_servicediscovery.DnsRecordType_A, DnsTtl: cdk.Duration_Minutes(jsii.Number(30)), FailureThreshold: jsii.Number(123), Name: jsii.String("name"), }, Cluster: cluster, DeploymentController: &DeploymentController{ Type: awscdk.Aws_ecs.DeploymentControllerType_ECS, }, DesiredCount: jsii.Number(123), DomainName: jsii.String("domainName"), DomainZone: hostedZone, EnableECSManagedTags: jsii.Boolean(false), EnableExecuteCommand: jsii.Boolean(false), HealthCheckGracePeriod: cdk.Duration_*Minutes(jsii.Number(30)), IpAddressType: awscdk.Aws_elasticloadbalancingv2.IpAddressType_IPV4, ListenerPort: jsii.Number(123), LoadBalancer: networkLoadBalancer, MaxHealthyPercent: jsii.Number(123), MinHealthyPercent: jsii.Number(123), PropagateTags: awscdk.*Aws_ecs.PropagatedTagSource_SERVICE, PublicLoadBalancer: jsii.Boolean(false), RecordType: awscdk.Aws_ecs_patterns.NetworkLoadBalancedServiceRecordType_ALIAS, ServiceName: jsii.String("serviceName"), TaskImageOptions: &NetworkLoadBalancedTaskImageOptions{ Image: containerImage, // the properties below are optional ContainerName: jsii.String("containerName"), ContainerPort: jsii.Number(123), DockerLabels: map[string]*string{ "dockerLabelsKey": jsii.String("dockerLabels"), }, EnableLogging: jsii.Boolean(false), Environment: map[string]*string{ "environmentKey": jsii.String("environment"), }, ExecutionRole: role, Family: jsii.String("family"), LogDriver: logDriver, Secrets: map[string]*secret{ "secretsKey": secret, }, TaskRole: role, }, Vpc: vpc, }
type NetworkLoadBalancedServiceRecordType ¶
type NetworkLoadBalancedServiceRecordType string
Describes the type of DNS record the service should create.
const ( // Create Route53 A Alias record. NetworkLoadBalancedServiceRecordType_ALIAS NetworkLoadBalancedServiceRecordType = "ALIAS" // Create a CNAME record. NetworkLoadBalancedServiceRecordType_CNAME NetworkLoadBalancedServiceRecordType = "CNAME" // Do not create any DNS records. NetworkLoadBalancedServiceRecordType_NONE NetworkLoadBalancedServiceRecordType = "NONE" )
type NetworkLoadBalancedTaskImageOptions ¶
type NetworkLoadBalancedTaskImageOptions struct { // The image used to start a container. // // Image or taskDefinition must be specified, but not both. // Default: - none. // Image awsecs.ContainerImage `field:"required" json:"image" yaml:"image"` // The container name value to be specified in the task definition. // Default: - none. // ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` // The port number on the container that is bound to the user-specified or automatically assigned host port. // // If you are using containers in a task with the awsvpc or host network mode, exposed ports should be specified using containerPort. // If you are using containers in a task with the bridge network mode and you specify a container port and not a host port, // your container automatically receives a host port in the ephemeral port range. // // Port mappings that are automatically assigned in this way do not count toward the 100 reserved ports limit of a container instance. // // For more information, see // [hostPort](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PortMapping.html#ECS-Type-PortMapping-hostPort). // Default: 80. // ContainerPort *float64 `field:"optional" json:"containerPort" yaml:"containerPort"` // A key/value map of labels to add to the container. // Default: - No labels. // DockerLabels *map[string]*string `field:"optional" json:"dockerLabels" yaml:"dockerLabels"` // Flag to indicate whether to enable logging. // Default: true. // EnableLogging *bool `field:"optional" json:"enableLogging" yaml:"enableLogging"` // The environment variables to pass to the container. // Default: - No environment variables. // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The name of the task execution IAM role that grants the Amazon ECS container agent permission to call AWS APIs on your behalf. // Default: - No value. // ExecutionRole awsiam.IRole `field:"optional" json:"executionRole" yaml:"executionRole"` // The name of a family that this task definition is registered to. // // A family groups multiple versions of a task definition. // Default: - Automatically generated name. // Family *string `field:"optional" json:"family" yaml:"family"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The secret to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` // The name of the task IAM role that grants containers in the task permission to call AWS APIs on your behalf. // Default: - A task role is automatically created for you. // TaskRole awsiam.IRole `field:"optional" json:"taskRole" yaml:"taskRole"` }
Example:
var cluster cluster loadBalancedEcsService := ecsPatterns.NewNetworkLoadBalancedEc2Service(this, jsii.String("Service"), &NetworkLoadBalancedEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), TaskImageOptions: &NetworkLoadBalancedTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("test")), Environment: map[string]*string{ "TEST_ENVIRONMENT_VARIABLE1": jsii.String("test environment variable 1 value"), "TEST_ENVIRONMENT_VARIABLE2": jsii.String("test environment variable 2 value"), }, }, DesiredCount: jsii.Number(2), })
type NetworkLoadBalancedTaskImageProps ¶
type NetworkLoadBalancedTaskImageProps struct { // The image used to start a container. // // Image or taskDefinition must be specified, but not both. // Default: - none. // Image awsecs.ContainerImage `field:"required" json:"image" yaml:"image"` // The container name value to be specified in the task definition. // Default: - none. // ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` // A list of port numbers on the container that is bound to the user-specified or automatically assigned host port. // // If you are using containers in a task with the awsvpc or host network mode, exposed ports should be specified using containerPort. // If you are using containers in a task with the bridge network mode and you specify a container port and not a host port, // your container automatically receives a host port in the ephemeral port range. // // Port mappings that are automatically assigned in this way do not count toward the 100 reserved ports limit of a container instance. // // For more information, see // [hostPort](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PortMapping.html#ECS-Type-PortMapping-hostPort). // Default: - [80]. // ContainerPorts *[]*float64 `field:"optional" json:"containerPorts" yaml:"containerPorts"` // A key/value map of labels to add to the container. // Default: - No labels. // DockerLabels *map[string]*string `field:"optional" json:"dockerLabels" yaml:"dockerLabels"` // Flag to indicate whether to enable logging. // Default: true. // EnableLogging *bool `field:"optional" json:"enableLogging" yaml:"enableLogging"` // The environment variables to pass to the container. // Default: - No environment variables. // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The name of the task execution IAM role that grants the Amazon ECS container agent permission to call AWS APIs on your behalf. // Default: - No value. // ExecutionRole awsiam.IRole `field:"optional" json:"executionRole" yaml:"executionRole"` // The name of a family that this task definition is registered to. // // A family groups multiple versions of a task definition. // Default: - Automatically generated name. // Family *string `field:"optional" json:"family" yaml:"family"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The secrets to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` // The name of the task IAM role that grants containers in the task permission to call AWS APIs on your behalf. // Default: - A task role is automatically created for you. // TaskRole awsiam.IRole `field:"optional" json:"taskRole" yaml:"taskRole"` }
Options for configuring a new container.
Example:
// Two network load balancers, each with their own listener and target group. var cluster cluster loadBalancedEc2Service := ecsPatterns.NewNetworkMultipleTargetGroupsEc2Service(this, jsii.String("Service"), &NetworkMultipleTargetGroupsEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(256), TaskImageOptions: &NetworkLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, LoadBalancers: []networkLoadBalancerProps{ &networkLoadBalancerProps{ Name: jsii.String("lb1"), Listeners: []networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener1"), }, }, }, &networkLoadBalancerProps{ Name: jsii.String("lb2"), Listeners: []*networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener2"), }, }, }, }, TargetGroups: []networkTargetProps{ &networkTargetProps{ ContainerPort: jsii.Number(80), Listener: jsii.String("listener1"), }, &networkTargetProps{ ContainerPort: jsii.Number(90), Listener: jsii.String("listener2"), }, }, })
type NetworkLoadBalancerProps ¶
type NetworkLoadBalancerProps struct { // Listeners (at least one listener) attached to this load balancer. // Default: - none. // Listeners *[]*NetworkListenerProps `field:"required" json:"listeners" yaml:"listeners"` // Name of the load balancer. Name *string `field:"required" json:"name" yaml:"name"` // The domain name for the service, e.g. "api.example.com.". // Default: - No domain name. // DomainName *string `field:"optional" json:"domainName" yaml:"domainName"` // The Route53 hosted zone for the domain, e.g. "example.com.". // Default: - No Route53 hosted domain zone. // DomainZone awsroute53.IHostedZone `field:"optional" json:"domainZone" yaml:"domainZone"` // Determines whether the Load Balancer will be internet-facing. // Default: true. // PublicLoadBalancer *bool `field:"optional" json:"publicLoadBalancer" yaml:"publicLoadBalancer"` }
Properties to define an network load balancer.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var hostedZone hostedZone networkLoadBalancerProps := &NetworkLoadBalancerProps{ Listeners: []networkListenerProps{ &networkListenerProps{ Name: jsii.String("name"), // the properties below are optional Port: jsii.Number(123), }, }, Name: jsii.String("name"), // the properties below are optional DomainName: jsii.String("domainName"), DomainZone: hostedZone, PublicLoadBalancer: jsii.Boolean(false), }
type NetworkMultipleTargetGroupsEc2Service ¶
type NetworkMultipleTargetGroupsEc2Service interface { NetworkMultipleTargetGroupsServiceBase // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service, if one is not provided. InternalDesiredCount() *float64 // The listener for the service. // Deprecated: - Use `listeners` instead. Listener() awselasticloadbalancingv2.NetworkListener // The listeners of the service. Listeners() *[]awselasticloadbalancingv2.NetworkListener // The Network Load Balancer for the service. // Deprecated: - Use `loadBalancers` instead. LoadBalancer() awselasticloadbalancingv2.NetworkLoadBalancer // The load balancers of the service. LoadBalancers() *[]awselasticloadbalancingv2.NetworkLoadBalancer LogDriver() awsecs.LogDriver SetLogDriver(val awsecs.LogDriver) // The tree node. Node() constructs.Node // The EC2 service in this construct. Service() awsecs.Ec2Service // The default target group for the service. // Deprecated: - Use `targetGroups` instead. TargetGroup() awselasticloadbalancingv2.NetworkTargetGroup // The target groups of the service. TargetGroups() *[]awselasticloadbalancingv2.NetworkTargetGroup // The EC2 Task Definition in this construct. TaskDefinition() awsecs.Ec2TaskDefinition AddPortMappingForTargets(container awsecs.ContainerDefinition, targets *[]*NetworkTargetProps) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver FindListener(name *string) awselasticloadbalancingv2.NetworkListener // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster RegisterECSTargets(service awsecs.BaseService, container awsecs.ContainerDefinition, targets *[]*NetworkTargetProps) awselasticloadbalancingv2.NetworkTargetGroup // Returns a string representation of this construct. ToString() *string }
An EC2 service running on an ECS cluster fronted by a network load balancer.
Example:
// Two network load balancers, each with their own listener and target group. var cluster cluster loadBalancedEc2Service := ecsPatterns.NewNetworkMultipleTargetGroupsEc2Service(this, jsii.String("Service"), &NetworkMultipleTargetGroupsEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(256), TaskImageOptions: &NetworkLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, LoadBalancers: []networkLoadBalancerProps{ &networkLoadBalancerProps{ Name: jsii.String("lb1"), Listeners: []networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener1"), }, }, }, &networkLoadBalancerProps{ Name: jsii.String("lb2"), Listeners: []*networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener2"), }, }, }, }, TargetGroups: []networkTargetProps{ &networkTargetProps{ ContainerPort: jsii.Number(80), Listener: jsii.String("listener1"), }, &networkTargetProps{ ContainerPort: jsii.Number(90), Listener: jsii.String("listener2"), }, }, })
func NewNetworkMultipleTargetGroupsEc2Service ¶
func NewNetworkMultipleTargetGroupsEc2Service(scope constructs.Construct, id *string, props *NetworkMultipleTargetGroupsEc2ServiceProps) NetworkMultipleTargetGroupsEc2Service
Constructs a new instance of the NetworkMultipleTargetGroupsEc2Service class.
type NetworkMultipleTargetGroupsEc2ServiceProps ¶
type NetworkMultipleTargetGroupsEc2ServiceProps struct { // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The network load balancer that will serve traffic to the service. // Default: - a new load balancer with a listener will be created. // LoadBalancers *[]*NetworkLoadBalancerProps `field:"optional" json:"loadBalancers" yaml:"loadBalancers"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // Name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // Properties to specify NLB target groups. // Default: - default portMapping registered as target group and attached to the first defined listener. // TargetGroups *[]*NetworkTargetProps `field:"optional" json:"targetGroups" yaml:"targetGroups"` // The properties required to create a new task definition. // // Only one of TaskDefinition or TaskImageOptions must be specified. // Default: - none. // TaskImageOptions *NetworkLoadBalancedTaskImageProps `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The minimum number of CPU units to reserve for the container. // // Valid values, which determines your range of valid values for the memory parameter:. // Default: - No minimum CPU units reserved. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in MiB) of memory to present to the container. // // If your container attempts to exceed the allocated memory, the container // is terminated. // // At least one of memoryLimitMiB and memoryReservationMiB is required. // Default: - No memory limit. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // The soft limit (in MiB) of memory to reserve for the container. // // When system memory is under heavy contention, Docker attempts to keep the // container memory to this soft limit. However, your container can consume more // memory when it needs to, up to either the hard limit specified with the memory // parameter (if applicable), or all of the available memory on the container // instance, whichever comes first. // // At least one of memoryLimitMiB and memoryReservationMiB is required. // // Note that this setting will be ignored if TaskImagesOptions is specified. // Default: - No memory reserved. // MemoryReservationMiB *float64 `field:"optional" json:"memoryReservationMiB" yaml:"memoryReservationMiB"` // The placement constraints to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html). // Default: - No constraints. // PlacementConstraints *[]awsecs.PlacementConstraint `field:"optional" json:"placementConstraints" yaml:"placementConstraints"` // The placement strategies to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html). // Default: - No strategies. // PlacementStrategies *[]awsecs.PlacementStrategy `field:"optional" json:"placementStrategies" yaml:"placementStrategies"` // The task definition to use for tasks in the service. Only one of TaskDefinition or TaskImageOptions must be specified. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.Ec2TaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` }
The properties for the NetworkMultipleTargetGroupsEc2Service service.
Example:
// Two network load balancers, each with their own listener and target group. var cluster cluster loadBalancedEc2Service := ecsPatterns.NewNetworkMultipleTargetGroupsEc2Service(this, jsii.String("Service"), &NetworkMultipleTargetGroupsEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(256), TaskImageOptions: &NetworkLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, LoadBalancers: []networkLoadBalancerProps{ &networkLoadBalancerProps{ Name: jsii.String("lb1"), Listeners: []networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener1"), }, }, }, &networkLoadBalancerProps{ Name: jsii.String("lb2"), Listeners: []*networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener2"), }, }, }, }, TargetGroups: []networkTargetProps{ &networkTargetProps{ ContainerPort: jsii.Number(80), Listener: jsii.String("listener1"), }, &networkTargetProps{ ContainerPort: jsii.Number(90), Listener: jsii.String("listener2"), }, }, })
type NetworkMultipleTargetGroupsFargateService ¶
type NetworkMultipleTargetGroupsFargateService interface { NetworkMultipleTargetGroupsServiceBase // Determines whether the service will be assigned a public IP address. AssignPublicIp() *bool // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service, if one is not provided. InternalDesiredCount() *float64 // The listener for the service. // Deprecated: - Use `listeners` instead. Listener() awselasticloadbalancingv2.NetworkListener // The listeners of the service. Listeners() *[]awselasticloadbalancingv2.NetworkListener // The Network Load Balancer for the service. // Deprecated: - Use `loadBalancers` instead. LoadBalancer() awselasticloadbalancingv2.NetworkLoadBalancer // The load balancers of the service. LoadBalancers() *[]awselasticloadbalancingv2.NetworkLoadBalancer LogDriver() awsecs.LogDriver SetLogDriver(val awsecs.LogDriver) // The tree node. Node() constructs.Node // The Fargate service in this construct. Service() awsecs.FargateService // The default target group for the service. // Deprecated: - Use `targetGroups` instead. TargetGroup() awselasticloadbalancingv2.NetworkTargetGroup // The target groups of the service. TargetGroups() *[]awselasticloadbalancingv2.NetworkTargetGroup // The Fargate task definition in this construct. TaskDefinition() awsecs.FargateTaskDefinition AddPortMappingForTargets(container awsecs.ContainerDefinition, targets *[]*NetworkTargetProps) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver FindListener(name *string) awselasticloadbalancingv2.NetworkListener // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster RegisterECSTargets(service awsecs.BaseService, container awsecs.ContainerDefinition, targets *[]*NetworkTargetProps) awselasticloadbalancingv2.NetworkTargetGroup // Returns a string representation of this construct. ToString() *string }
A Fargate service running on an ECS cluster fronted by a network load balancer.
Example:
// Two network load balancers, each with their own listener and target group. var cluster cluster loadBalancedFargateService := ecsPatterns.NewNetworkMultipleTargetGroupsFargateService(this, jsii.String("Service"), &NetworkMultipleTargetGroupsFargateServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(512), TaskImageOptions: &NetworkLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, LoadBalancers: []networkLoadBalancerProps{ &networkLoadBalancerProps{ Name: jsii.String("lb1"), Listeners: []networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener1"), }, }, }, &networkLoadBalancerProps{ Name: jsii.String("lb2"), Listeners: []*networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener2"), }, }, }, }, TargetGroups: []networkTargetProps{ &networkTargetProps{ ContainerPort: jsii.Number(80), Listener: jsii.String("listener1"), }, &networkTargetProps{ ContainerPort: jsii.Number(90), Listener: jsii.String("listener2"), }, }, })
func NewNetworkMultipleTargetGroupsFargateService ¶
func NewNetworkMultipleTargetGroupsFargateService(scope constructs.Construct, id *string, props *NetworkMultipleTargetGroupsFargateServiceProps) NetworkMultipleTargetGroupsFargateService
Constructs a new instance of the NetworkMultipleTargetGroupsFargateService class.
type NetworkMultipleTargetGroupsFargateServiceProps ¶
type NetworkMultipleTargetGroupsFargateServiceProps struct { // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The network load balancer that will serve traffic to the service. // Default: - a new load balancer with a listener will be created. // LoadBalancers *[]*NetworkLoadBalancerProps `field:"optional" json:"loadBalancers" yaml:"loadBalancers"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // Name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // Properties to specify NLB target groups. // Default: - default portMapping registered as target group and attached to the first defined listener. // TargetGroups *[]*NetworkTargetProps `field:"optional" json:"targetGroups" yaml:"targetGroups"` // The properties required to create a new task definition. // // Only one of TaskDefinition or TaskImageOptions must be specified. // Default: - none. // TaskImageOptions *NetworkLoadBalancedTaskImageProps `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments // // 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: 256. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in GiB) of ephemeral storage to be allocated to the task. // // The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. // // Only supported in Fargate platform version 1.4.0 or later. // Default: Undefined, in which case, the task will receive 20GiB ephemeral storage. // EphemeralStorageGiB *float64 `field:"optional" json:"ephemeralStorageGiB" yaml:"ephemeralStorageGiB"` // The amount (in MiB) of memory used by the task. // // This field is required and you must use one of the following values, which determines your range of valid values // for the cpu parameter: // // 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) // // 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) // // 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) // // Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) // // Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) // // Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) // // Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) // // This default is set in the underlying FargateTaskDefinition construct. // Default: 512. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // 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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) // in the Amazon Elastic Container Service Developer Guide. // Default: Latest. // PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // The runtime platform of the task definition. // Default: - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64. // RuntimePlatform *awsecs.RuntimePlatform `field:"optional" json:"runtimePlatform" yaml:"runtimePlatform"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.FargateTaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` // Determines whether the service will be assigned a public IP address. // Default: false. // AssignPublicIp *bool `field:"optional" json:"assignPublicIp" yaml:"assignPublicIp"` }
The properties for the NetworkMultipleTargetGroupsFargateService service.
Example:
// Two network load balancers, each with their own listener and target group. var cluster cluster loadBalancedFargateService := ecsPatterns.NewNetworkMultipleTargetGroupsFargateService(this, jsii.String("Service"), &NetworkMultipleTargetGroupsFargateServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(512), TaskImageOptions: &NetworkLoadBalancedTaskImageProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), }, LoadBalancers: []networkLoadBalancerProps{ &networkLoadBalancerProps{ Name: jsii.String("lb1"), Listeners: []networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener1"), }, }, }, &networkLoadBalancerProps{ Name: jsii.String("lb2"), Listeners: []*networkListenerProps{ &networkListenerProps{ Name: jsii.String("listener2"), }, }, }, }, TargetGroups: []networkTargetProps{ &networkTargetProps{ ContainerPort: jsii.Number(80), Listener: jsii.String("listener1"), }, &networkTargetProps{ ContainerPort: jsii.Number(90), Listener: jsii.String("listener2"), }, }, })
type NetworkMultipleTargetGroupsServiceBase ¶
type NetworkMultipleTargetGroupsServiceBase interface { constructs.Construct // The cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The default is 1 for all new services and uses the existing services desired count // when updating an existing service, if one is not provided. InternalDesiredCount() *float64 // The listener for the service. // Deprecated: - Use `listeners` instead. Listener() awselasticloadbalancingv2.NetworkListener // The listeners of the service. Listeners() *[]awselasticloadbalancingv2.NetworkListener // The Network Load Balancer for the service. // Deprecated: - Use `loadBalancers` instead. LoadBalancer() awselasticloadbalancingv2.NetworkLoadBalancer // The load balancers of the service. LoadBalancers() *[]awselasticloadbalancingv2.NetworkLoadBalancer LogDriver() awsecs.LogDriver SetLogDriver(val awsecs.LogDriver) // The tree node. Node() constructs.Node // The target groups of the service. TargetGroups() *[]awselasticloadbalancingv2.NetworkTargetGroup AddPortMappingForTargets(container awsecs.ContainerDefinition, targets *[]*NetworkTargetProps) CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver FindListener(name *string) awselasticloadbalancingv2.NetworkListener // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster RegisterECSTargets(service awsecs.BaseService, container awsecs.ContainerDefinition, targets *[]*NetworkTargetProps) awselasticloadbalancingv2.NetworkTargetGroup // Returns a string representation of this construct. ToString() *string }
The base class for NetworkMultipleTargetGroupsEc2Service and NetworkMultipleTargetGroupsFargateService classes.
type NetworkMultipleTargetGroupsServiceBaseProps ¶
type NetworkMultipleTargetGroupsServiceBaseProps struct { // The options for configuring an Amazon ECS service to use service discovery. // Default: - AWS Cloud Map service discovery is not enabled. // CloudMapOptions *awsecs.CloudMapOptions `field:"optional" json:"cloudMapOptions" yaml:"cloudMapOptions"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. // Default: - The default is 1 for all new services and uses the existing service's desired count // when updating an existing service. // DesiredCount *float64 `field:"optional" json:"desiredCount" yaml:"desiredCount"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. // Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set. // HealthCheckGracePeriod awscdk.Duration `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // The network load balancer that will serve traffic to the service. // Default: - a new load balancer with a listener will be created. // LoadBalancers *[]*NetworkLoadBalancerProps `field:"optional" json:"loadBalancers" yaml:"loadBalancers"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // Name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // Properties to specify NLB target groups. // Default: - default portMapping registered as target group and attached to the first defined listener. // TargetGroups *[]*NetworkTargetProps `field:"optional" json:"targetGroups" yaml:"targetGroups"` // The properties required to create a new task definition. // // Only one of TaskDefinition or TaskImageOptions must be specified. // Default: - none. // TaskImageOptions *NetworkLoadBalancedTaskImageProps `field:"optional" json:"taskImageOptions" yaml:"taskImageOptions"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` }
The properties for the base NetworkMultipleTargetGroupsEc2Service or NetworkMultipleTargetGroupsFargateService service.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var cluster cluster var containerDefinition containerDefinition var containerImage containerImage var hostedZone hostedZone var logDriver logDriver var namespace iNamespace var role role var secret secret var vpc vpc networkMultipleTargetGroupsServiceBaseProps := &NetworkMultipleTargetGroupsServiceBaseProps{ CloudMapOptions: &CloudMapOptions{ CloudMapNamespace: namespace, Container: containerDefinition, ContainerPort: jsii.Number(123), DnsRecordType: awscdk.Aws_servicediscovery.DnsRecordType_A, DnsTtl: cdk.Duration_Minutes(jsii.Number(30)), FailureThreshold: jsii.Number(123), Name: jsii.String("name"), }, Cluster: cluster, DesiredCount: jsii.Number(123), EnableECSManagedTags: jsii.Boolean(false), EnableExecuteCommand: jsii.Boolean(false), HealthCheckGracePeriod: cdk.Duration_*Minutes(jsii.Number(30)), LoadBalancers: []networkLoadBalancerProps{ &networkLoadBalancerProps{ Listeners: []networkListenerProps{ &networkListenerProps{ Name: jsii.String("name"), // the properties below are optional Port: jsii.Number(123), }, }, Name: jsii.String("name"), // the properties below are optional DomainName: jsii.String("domainName"), DomainZone: hostedZone, PublicLoadBalancer: jsii.Boolean(false), }, }, PropagateTags: awscdk.Aws_ecs.PropagatedTagSource_SERVICE, ServiceName: jsii.String("serviceName"), TargetGroups: []networkTargetProps{ &networkTargetProps{ ContainerPort: jsii.Number(123), // the properties below are optional Listener: jsii.String("listener"), }, }, TaskImageOptions: &NetworkLoadBalancedTaskImageProps{ Image: containerImage, // the properties below are optional ContainerName: jsii.String("containerName"), ContainerPorts: []*f64{ jsii.Number(123), }, DockerLabels: map[string]*string{ "dockerLabelsKey": jsii.String("dockerLabels"), }, EnableLogging: jsii.Boolean(false), Environment: map[string]*string{ "environmentKey": jsii.String("environment"), }, ExecutionRole: role, Family: jsii.String("family"), LogDriver: logDriver, Secrets: map[string]*secret{ "secretsKey": secret, }, TaskRole: role, }, Vpc: vpc, }
type NetworkTargetProps ¶
type NetworkTargetProps struct { // The port number of the container. // // Only applicable when using application/network load balancers. ContainerPort *float64 `field:"required" json:"containerPort" yaml:"containerPort"` // Name of the listener the target group attached to. // Default: - default listener (first added listener). // Listener *string `field:"optional" json:"listener" yaml:"listener"` }
Properties to define a network load balancer target group.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" networkTargetProps := &NetworkTargetProps{ ContainerPort: jsii.Number(123), // the properties below are optional Listener: jsii.String("listener"), }
type QueueProcessingEc2Service ¶
type QueueProcessingEc2Service interface { QueueProcessingServiceBase // The cluster where your service will be deployed. Cluster() awsecs.ICluster // The dead letter queue for the primary SQS queue. DeadLetterQueue() awssqs.IQueue // Environment variables that will include the queue name. Environment() *map[string]*string // The AwsLogDriver to use for logging if logging is enabled. LogDriver() awsecs.LogDriver // The maximum number of instances for autoscaling to scale up to. MaxCapacity() *float64 // The minimum number of instances for autoscaling to scale down to. MinCapacity() *float64 // The tree node. Node() constructs.Node // The scaling interval for autoscaling based off an SQS Queue size. ScalingSteps() *[]*awsapplicationautoscaling.ScalingInterval // The secret environment variables. Secrets() *map[string]awsecs.Secret // The EC2 service in this construct. Service() awsecs.Ec2Service // The SQS queue that the service will process from. SqsQueue() awssqs.IQueue // The EC2 task definition in this construct. TaskDefinition() awsecs.Ec2TaskDefinition // Configure autoscaling based off of CPU utilization as well as the number of messages visible in the SQS queue. ConfigureAutoscalingForService(service awsecs.BaseService) // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Grant SQS permissions to an ECS service. GrantPermissionsToService(service awsecs.BaseService) // Returns a string representation of this construct. ToString() *string }
Class to create a queue processing EC2 service.
Example:
var cluster cluster queueProcessingEc2Service := ecsPatterns.NewQueueProcessingEc2Service(this, jsii.String("Service"), &QueueProcessingEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), Image: ecs.ContainerImage_FromRegistry(jsii.String("test")), Command: []*string{ jsii.String("-c"), jsii.String("4"), jsii.String("amazon.com"), }, EnableLogging: jsii.Boolean(false), DesiredTaskCount: jsii.Number(2), Environment: map[string]*string{ "TEST_ENVIRONMENT_VARIABLE1": jsii.String("test environment variable 1 value"), "TEST_ENVIRONMENT_VARIABLE2": jsii.String("test environment variable 2 value"), }, MaxScalingCapacity: jsii.Number(5), ContainerName: jsii.String("test"), })
func NewQueueProcessingEc2Service ¶
func NewQueueProcessingEc2Service(scope constructs.Construct, id *string, props *QueueProcessingEc2ServiceProps) QueueProcessingEc2Service
Constructs a new instance of the QueueProcessingEc2Service class.
type QueueProcessingEc2ServiceProps ¶
type QueueProcessingEc2ServiceProps struct { // A list of Capacity Provider strategies used to place a service. // Default: - undefined. // CapacityProviderStrategies *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. // Default: - disabled. // CircuitBreaker *awsecs.DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The command that is passed to the container. // // If you provide a shell command as a single string, you have to quote command-line arguments. // Default: - CMD value built into container image. // Command *[]*string `field:"optional" json:"command" yaml:"command"` // Grace period after scaling activity in seconds. // // Subsequent scale outs during the cooldown period are squashed so that only // the biggest scale out happens. // // Subsequent scale ins during the cooldown period are ignored. // See: https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html // // Default: 300 seconds. // Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // The target CPU utilization percentage for CPU based scaling strategy when enabled. // Default: - 50. // CpuTargetUtilizationPercent *float64 `field:"optional" json:"cpuTargetUtilizationPercent" yaml:"cpuTargetUtilizationPercent"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) // Default: - Rolling update (ECS). // DeploymentController *awsecs.DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // Flag to disable CPU based auto scaling strategy on the service. // Default: - false. // DisableCpuBasedScaling *bool `field:"optional" json:"disableCpuBasedScaling" yaml:"disableCpuBasedScaling"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // Flag to indicate whether to enable logging. // Default: true. // EnableLogging *bool `field:"optional" json:"enableLogging" yaml:"enableLogging"` // The environment variables to pass to the container. // // The variable `QUEUE_NAME` with value `queue.queueName` will // always be passed. // Default: 'QUEUE_NAME: queue.queueName' // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The name of a family that the task definition is registered to. // // A family groups multiple versions of a task definition. // Default: - Automatically generated name. // Family *string `field:"optional" json:"family" yaml:"family"` // The image used to start a container. // // For `QueueProcessingFargateService`, either `image` or `taskDefinition` must be specified, but not both. // For `QueueProcessingEc2Service`, `image` is required. // Default: - the image of the task definition is used for Fargate, required otherwise. // Image awsecs.ContainerImage `field:"optional" json:"image" yaml:"image"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. // Default: - default from underlying service. // MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // The maximum number of times that a message can be received by consumers. // // When this value is exceeded for a message the message will be automatically sent to the Dead Letter Queue. // // If the queue construct is specified, maxReceiveCount should be omitted. // Default: 3. // MaxReceiveCount *float64 `field:"optional" json:"maxReceiveCount" yaml:"maxReceiveCount"` // Maximum capacity to scale to. // Default: 2. // MaxScalingCapacity *float64 `field:"optional" json:"maxScalingCapacity" yaml:"maxScalingCapacity"` // The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. // Default: - default from underlying service. // MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // Minimum capacity to scale to. // Default: 1. // MinScalingCapacity *float64 `field:"optional" json:"minScalingCapacity" yaml:"minScalingCapacity"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // A queue for which to process items from. // // If specified and this is a FIFO queue, the queue name must end in the string '.fifo'. See // [CreateQueue](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html) // Default: 'SQSQueue with CloudFormation-generated name'. // Queue awssqs.IQueue `field:"optional" json:"queue" yaml:"queue"` // The number of seconds that Dead Letter Queue retains a message. // // If the queue construct is specified, retentionPeriod should be omitted. // Default: Duration.days(14) // RetentionPeriod awscdk.Duration `field:"optional" json:"retentionPeriod" yaml:"retentionPeriod"` // The intervals for scaling based on the SQS queue's ApproximateNumberOfMessagesVisible metric. // // Maps a range of metric values to a particular scaling behavior. See // [Simple and Step Scaling Policies for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html) // Default: [{ upper: 0, change: -1 },{ lower: 100, change: +1 },{ lower: 500, change: +5 }]. // ScalingSteps *[]*awsapplicationautoscaling.ScalingInterval `field:"optional" json:"scalingSteps" yaml:"scalingSteps"` // The secret to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // Timeout of processing a single message. // // After dequeuing, the processor has this much time to handle the message and delete it from the queue // before it becomes visible again for dequeueing by another processor. Values must be between 0 and (12 hours). // // If the queue construct is specified, visibilityTimeout should be omitted. // Default: Duration.seconds(30) // VisibilityTimeout awscdk.Duration `field:"optional" json:"visibilityTimeout" yaml:"visibilityTimeout"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // Optional name for the container added. // Default: - QueueProcessingContainer. // ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: none. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // Gpu count for container in task definition. // // Set this if you want to use gpu based instances. // Default: - No GPUs assigned. // GpuCount *float64 `field:"optional" json:"gpuCount" yaml:"gpuCount"` // The hard limit (in MiB) of memory to present to the container. // // If your container attempts to exceed the allocated memory, the container // is terminated. // // At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services. // Default: - No memory limit. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // The soft limit (in MiB) of memory to reserve for the container. // // When system memory is under contention, Docker attempts to keep the // container memory within the limit. If the container requires more memory, // it can consume up to the value specified by the Memory property or all of // the available memory on the container instance—whichever comes first. // // At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services. // Default: - No memory reserved. // MemoryReservationMiB *float64 `field:"optional" json:"memoryReservationMiB" yaml:"memoryReservationMiB"` // The placement constraints to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html). // Default: - No constraints. // PlacementConstraints *[]awsecs.PlacementConstraint `field:"optional" json:"placementConstraints" yaml:"placementConstraints"` // The placement strategies to use for tasks in the service. // // For more information, see // [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html). // Default: - No strategies. // PlacementStrategies *[]awsecs.PlacementStrategy `field:"optional" json:"placementStrategies" yaml:"placementStrategies"` }
The properties for the QueueProcessingEc2Service service.
Example:
var cluster cluster queueProcessingEc2Service := ecsPatterns.NewQueueProcessingEc2Service(this, jsii.String("Service"), &QueueProcessingEc2ServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(1024), Image: ecs.ContainerImage_FromRegistry(jsii.String("test")), Command: []*string{ jsii.String("-c"), jsii.String("4"), jsii.String("amazon.com"), }, EnableLogging: jsii.Boolean(false), DesiredTaskCount: jsii.Number(2), Environment: map[string]*string{ "TEST_ENVIRONMENT_VARIABLE1": jsii.String("test environment variable 1 value"), "TEST_ENVIRONMENT_VARIABLE2": jsii.String("test environment variable 2 value"), }, MaxScalingCapacity: jsii.Number(5), ContainerName: jsii.String("test"), })
type QueueProcessingFargateService ¶
type QueueProcessingFargateService interface { QueueProcessingServiceBase // The cluster where your service will be deployed. Cluster() awsecs.ICluster // The dead letter queue for the primary SQS queue. DeadLetterQueue() awssqs.IQueue // Environment variables that will include the queue name. Environment() *map[string]*string // The AwsLogDriver to use for logging if logging is enabled. LogDriver() awsecs.LogDriver // The maximum number of instances for autoscaling to scale up to. MaxCapacity() *float64 // The minimum number of instances for autoscaling to scale down to. MinCapacity() *float64 // The tree node. Node() constructs.Node // The scaling interval for autoscaling based off an SQS Queue size. ScalingSteps() *[]*awsapplicationautoscaling.ScalingInterval // The secret environment variables. Secrets() *map[string]awsecs.Secret // The Fargate service in this construct. Service() awsecs.FargateService // The SQS queue that the service will process from. SqsQueue() awssqs.IQueue // The Fargate task definition in this construct. TaskDefinition() awsecs.FargateTaskDefinition // Configure autoscaling based off of CPU utilization as well as the number of messages visible in the SQS queue. ConfigureAutoscalingForService(service awsecs.BaseService) // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Grant SQS permissions to an ECS service. GrantPermissionsToService(service awsecs.BaseService) // Returns a string representation of this construct. ToString() *string }
Class to create a queue processing Fargate service.
Example:
var cluster cluster cluster.EnableFargateCapacityProviders() queueProcessingFargateService := ecsPatterns.NewQueueProcessingFargateService(this, jsii.String("Service"), &QueueProcessingFargateServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(512), Image: ecs.ContainerImage_FromRegistry(jsii.String("test")), CapacityProviderStrategies: []capacityProviderStrategy{ &capacityProviderStrategy{ CapacityProvider: jsii.String("FARGATE_SPOT"), Weight: jsii.Number(2), }, &capacityProviderStrategy{ CapacityProvider: jsii.String("FARGATE"), Weight: jsii.Number(1), }, }, })
func NewQueueProcessingFargateService ¶
func NewQueueProcessingFargateService(scope constructs.Construct, id *string, props *QueueProcessingFargateServiceProps) QueueProcessingFargateService
Constructs a new instance of the QueueProcessingFargateService class.
type QueueProcessingFargateServiceProps ¶
type QueueProcessingFargateServiceProps struct { // A list of Capacity Provider strategies used to place a service. // Default: - undefined. // CapacityProviderStrategies *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. // Default: - disabled. // CircuitBreaker *awsecs.DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The command that is passed to the container. // // If you provide a shell command as a single string, you have to quote command-line arguments. // Default: - CMD value built into container image. // Command *[]*string `field:"optional" json:"command" yaml:"command"` // Grace period after scaling activity in seconds. // // Subsequent scale outs during the cooldown period are squashed so that only // the biggest scale out happens. // // Subsequent scale ins during the cooldown period are ignored. // See: https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html // // Default: 300 seconds. // Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // The target CPU utilization percentage for CPU based scaling strategy when enabled. // Default: - 50. // CpuTargetUtilizationPercent *float64 `field:"optional" json:"cpuTargetUtilizationPercent" yaml:"cpuTargetUtilizationPercent"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) // Default: - Rolling update (ECS). // DeploymentController *awsecs.DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // Flag to disable CPU based auto scaling strategy on the service. // Default: - false. // DisableCpuBasedScaling *bool `field:"optional" json:"disableCpuBasedScaling" yaml:"disableCpuBasedScaling"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // Flag to indicate whether to enable logging. // Default: true. // EnableLogging *bool `field:"optional" json:"enableLogging" yaml:"enableLogging"` // The environment variables to pass to the container. // // The variable `QUEUE_NAME` with value `queue.queueName` will // always be passed. // Default: 'QUEUE_NAME: queue.queueName' // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The name of a family that the task definition is registered to. // // A family groups multiple versions of a task definition. // Default: - Automatically generated name. // Family *string `field:"optional" json:"family" yaml:"family"` // The image used to start a container. // // For `QueueProcessingFargateService`, either `image` or `taskDefinition` must be specified, but not both. // For `QueueProcessingEc2Service`, `image` is required. // Default: - the image of the task definition is used for Fargate, required otherwise. // Image awsecs.ContainerImage `field:"optional" json:"image" yaml:"image"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. // Default: - default from underlying service. // MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // The maximum number of times that a message can be received by consumers. // // When this value is exceeded for a message the message will be automatically sent to the Dead Letter Queue. // // If the queue construct is specified, maxReceiveCount should be omitted. // Default: 3. // MaxReceiveCount *float64 `field:"optional" json:"maxReceiveCount" yaml:"maxReceiveCount"` // Maximum capacity to scale to. // Default: 2. // MaxScalingCapacity *float64 `field:"optional" json:"maxScalingCapacity" yaml:"maxScalingCapacity"` // The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. // Default: - default from underlying service. // MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // Minimum capacity to scale to. // Default: 1. // MinScalingCapacity *float64 `field:"optional" json:"minScalingCapacity" yaml:"minScalingCapacity"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // A queue for which to process items from. // // If specified and this is a FIFO queue, the queue name must end in the string '.fifo'. See // [CreateQueue](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html) // Default: 'SQSQueue with CloudFormation-generated name'. // Queue awssqs.IQueue `field:"optional" json:"queue" yaml:"queue"` // The number of seconds that Dead Letter Queue retains a message. // // If the queue construct is specified, retentionPeriod should be omitted. // Default: Duration.days(14) // RetentionPeriod awscdk.Duration `field:"optional" json:"retentionPeriod" yaml:"retentionPeriod"` // The intervals for scaling based on the SQS queue's ApproximateNumberOfMessagesVisible metric. // // Maps a range of metric values to a particular scaling behavior. See // [Simple and Step Scaling Policies for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html) // Default: [{ upper: 0, change: -1 },{ lower: 100, change: +1 },{ lower: 500, change: +5 }]. // ScalingSteps *[]*awsapplicationautoscaling.ScalingInterval `field:"optional" json:"scalingSteps" yaml:"scalingSteps"` // The secret to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // Timeout of processing a single message. // // After dequeuing, the processor has this much time to handle the message and delete it from the queue // before it becomes visible again for dequeueing by another processor. Values must be between 0 and (12 hours). // // If the queue construct is specified, visibilityTimeout should be omitted. // Default: Duration.seconds(30) // VisibilityTimeout awscdk.Duration `field:"optional" json:"visibilityTimeout" yaml:"visibilityTimeout"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments // // 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: 256. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in GiB) of ephemeral storage to be allocated to the task. // // The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. // // Only supported in Fargate platform version 1.4.0 or later. // Default: Undefined, in which case, the task will receive 20GiB ephemeral storage. // EphemeralStorageGiB *float64 `field:"optional" json:"ephemeralStorageGiB" yaml:"ephemeralStorageGiB"` // The amount (in MiB) of memory used by the task. // // This field is required and you must use one of the following values, which determines your range of valid values // for the cpu parameter: // // 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) // // 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) // // 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) // // Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) // // Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) // // Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) // // Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) // // This default is set in the underlying FargateTaskDefinition construct. // Default: 512. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // 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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) // in the Amazon Elastic Container Service Developer Guide. // Default: Latest. // PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // The runtime platform of the task definition. // Default: - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64. // RuntimePlatform *awsecs.RuntimePlatform `field:"optional" json:"runtimePlatform" yaml:"runtimePlatform"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.FargateTaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` // 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. // AssignPublicIp *bool `field:"optional" json:"assignPublicIp" yaml:"assignPublicIp"` // Optional name for the container added. // // This name is not used when `taskDefinition` is provided. // Default: - QueueProcessingContainer. // ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` // The health check command and associated configuration parameters for the container. // Default: - Health check configuration from container. // HealthCheck *awsecs.HealthCheck `field:"optional" json:"healthCheck" yaml:"healthCheck"` // 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. // SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // 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. // TaskSubnets *awsec2.SubnetSelection `field:"optional" json:"taskSubnets" yaml:"taskSubnets"` }
The properties for the QueueProcessingFargateService service.
Example:
var cluster cluster cluster.EnableFargateCapacityProviders() queueProcessingFargateService := ecsPatterns.NewQueueProcessingFargateService(this, jsii.String("Service"), &QueueProcessingFargateServiceProps{ Cluster: Cluster, MemoryLimitMiB: jsii.Number(512), Image: ecs.ContainerImage_FromRegistry(jsii.String("test")), CapacityProviderStrategies: []capacityProviderStrategy{ &capacityProviderStrategy{ CapacityProvider: jsii.String("FARGATE_SPOT"), Weight: jsii.Number(2), }, &capacityProviderStrategy{ CapacityProvider: jsii.String("FARGATE"), Weight: jsii.Number(1), }, }, })
type QueueProcessingServiceBase ¶
type QueueProcessingServiceBase interface { constructs.Construct // The cluster where your service will be deployed. Cluster() awsecs.ICluster // The dead letter queue for the primary SQS queue. DeadLetterQueue() awssqs.IQueue // Environment variables that will include the queue name. Environment() *map[string]*string // The AwsLogDriver to use for logging if logging is enabled. LogDriver() awsecs.LogDriver // The maximum number of instances for autoscaling to scale up to. MaxCapacity() *float64 // The minimum number of instances for autoscaling to scale down to. MinCapacity() *float64 // The tree node. Node() constructs.Node // The scaling interval for autoscaling based off an SQS Queue size. ScalingSteps() *[]*awsapplicationautoscaling.ScalingInterval // The secret environment variables. Secrets() *map[string]awsecs.Secret // The SQS queue that the service will process from. SqsQueue() awssqs.IQueue // Configure autoscaling based off of CPU utilization as well as the number of messages visible in the SQS queue. ConfigureAutoscalingForService(service awsecs.BaseService) // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Grant SQS permissions to an ECS service. GrantPermissionsToService(service awsecs.BaseService) // Returns a string representation of this construct. ToString() *string }
The base class for QueueProcessingEc2Service and QueueProcessingFargateService services.
type QueueProcessingServiceBaseProps ¶
type QueueProcessingServiceBaseProps struct { // A list of Capacity Provider strategies used to place a service. // Default: - undefined. // CapacityProviderStrategies *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategies" yaml:"capacityProviderStrategies"` // Whether to enable the deployment circuit breaker. // // If this property is defined, circuit breaker will be implicitly // enabled. // Default: - disabled. // CircuitBreaker *awsecs.DeploymentCircuitBreaker `field:"optional" json:"circuitBreaker" yaml:"circuitBreaker"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The command that is passed to the container. // // If you provide a shell command as a single string, you have to quote command-line arguments. // Default: - CMD value built into container image. // Command *[]*string `field:"optional" json:"command" yaml:"command"` // Grace period after scaling activity in seconds. // // Subsequent scale outs during the cooldown period are squashed so that only // the biggest scale out happens. // // Subsequent scale ins during the cooldown period are ignored. // See: https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html // // Default: 300 seconds. // Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // The target CPU utilization percentage for CPU based scaling strategy when enabled. // Default: - 50. // CpuTargetUtilizationPercent *float64 `field:"optional" json:"cpuTargetUtilizationPercent" yaml:"cpuTargetUtilizationPercent"` // Specifies which deployment controller to use for the service. // // For more information, see // [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) // Default: - Rolling update (ECS). // DeploymentController *awsecs.DeploymentController `field:"optional" json:"deploymentController" yaml:"deploymentController"` // Flag to disable CPU based auto scaling strategy on the service. // Default: - false. // DisableCpuBasedScaling *bool `field:"optional" json:"disableCpuBasedScaling" yaml:"disableCpuBasedScaling"` // Specifies whether to enable Amazon ECS managed tags for the tasks within the service. // // For more information, see // [Tagging Your Amazon ECS Resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) // Default: false. // EnableECSManagedTags *bool `field:"optional" json:"enableECSManagedTags" yaml:"enableECSManagedTags"` // Whether ECS Exec should be enabled. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // Flag to indicate whether to enable logging. // Default: true. // EnableLogging *bool `field:"optional" json:"enableLogging" yaml:"enableLogging"` // The environment variables to pass to the container. // // The variable `QUEUE_NAME` with value `queue.queueName` will // always be passed. // Default: 'QUEUE_NAME: queue.queueName' // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The name of a family that the task definition is registered to. // // A family groups multiple versions of a task definition. // Default: - Automatically generated name. // Family *string `field:"optional" json:"family" yaml:"family"` // The image used to start a container. // // For `QueueProcessingFargateService`, either `image` or `taskDefinition` must be specified, but not both. // For `QueueProcessingEc2Service`, `image` is required. // Default: - the image of the task definition is used for Fargate, required otherwise. // Image awsecs.ContainerImage `field:"optional" json:"image" yaml:"image"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment. // Default: - default from underlying service. // MaxHealthyPercent *float64 `field:"optional" json:"maxHealthyPercent" yaml:"maxHealthyPercent"` // The maximum number of times that a message can be received by consumers. // // When this value is exceeded for a message the message will be automatically sent to the Dead Letter Queue. // // If the queue construct is specified, maxReceiveCount should be omitted. // Default: 3. // MaxReceiveCount *float64 `field:"optional" json:"maxReceiveCount" yaml:"maxReceiveCount"` // Maximum capacity to scale to. // Default: 2. // MaxScalingCapacity *float64 `field:"optional" json:"maxScalingCapacity" yaml:"maxScalingCapacity"` // The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment. // Default: - default from underlying service. // MinHealthyPercent *float64 `field:"optional" json:"minHealthyPercent" yaml:"minHealthyPercent"` // Minimum capacity to scale to. // Default: 1. // MinScalingCapacity *float64 `field:"optional" json:"minScalingCapacity" yaml:"minScalingCapacity"` // Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. // // Tags can only be propagated to the tasks within the service during service creation. // Default: - none. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // A queue for which to process items from. // // If specified and this is a FIFO queue, the queue name must end in the string '.fifo'. See // [CreateQueue](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html) // Default: 'SQSQueue with CloudFormation-generated name'. // Queue awssqs.IQueue `field:"optional" json:"queue" yaml:"queue"` // The number of seconds that Dead Letter Queue retains a message. // // If the queue construct is specified, retentionPeriod should be omitted. // Default: Duration.days(14) // RetentionPeriod awscdk.Duration `field:"optional" json:"retentionPeriod" yaml:"retentionPeriod"` // The intervals for scaling based on the SQS queue's ApproximateNumberOfMessagesVisible metric. // // Maps a range of metric values to a particular scaling behavior. See // [Simple and Step Scaling Policies for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html) // Default: [{ upper: 0, change: -1 },{ lower: 100, change: +1 },{ lower: 500, change: +5 }]. // ScalingSteps *[]*awsapplicationautoscaling.ScalingInterval `field:"optional" json:"scalingSteps" yaml:"scalingSteps"` // The secret to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` // The name of the service. // Default: - CloudFormation-generated name. // ServiceName *string `field:"optional" json:"serviceName" yaml:"serviceName"` // Timeout of processing a single message. // // After dequeuing, the processor has this much time to handle the message and delete it from the queue // before it becomes visible again for dequeueing by another processor. Values must be between 0 and (12 hours). // // If the queue construct is specified, visibilityTimeout should be omitted. // Default: Duration.seconds(30) // VisibilityTimeout awscdk.Duration `field:"optional" json:"visibilityTimeout" yaml:"visibilityTimeout"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` }
The properties for the base QueueProcessingEc2Service or QueueProcessingFargateService service.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var cluster cluster var containerImage containerImage var logDriver logDriver var queue queue var secret secret var vpc vpc queueProcessingServiceBaseProps := &QueueProcessingServiceBaseProps{ CapacityProviderStrategies: []capacityProviderStrategy{ &capacityProviderStrategy{ CapacityProvider: jsii.String("capacityProvider"), // the properties below are optional Base: jsii.Number(123), Weight: jsii.Number(123), }, }, CircuitBreaker: &DeploymentCircuitBreaker{ Enable: jsii.Boolean(false), Rollback: jsii.Boolean(false), }, Cluster: cluster, Command: []*string{ jsii.String("command"), }, Cooldown: cdk.Duration_Minutes(jsii.Number(30)), CpuTargetUtilizationPercent: jsii.Number(123), DeploymentController: &DeploymentController{ Type: awscdk.Aws_ecs.DeploymentControllerType_ECS, }, DisableCpuBasedScaling: jsii.Boolean(false), EnableECSManagedTags: jsii.Boolean(false), EnableExecuteCommand: jsii.Boolean(false), EnableLogging: jsii.Boolean(false), Environment: map[string]*string{ "environmentKey": jsii.String("environment"), }, Family: jsii.String("family"), Image: containerImage, LogDriver: logDriver, MaxHealthyPercent: jsii.Number(123), MaxReceiveCount: jsii.Number(123), MaxScalingCapacity: jsii.Number(123), MinHealthyPercent: jsii.Number(123), MinScalingCapacity: jsii.Number(123), PropagateTags: awscdk.*Aws_ecs.PropagatedTagSource_SERVICE, Queue: queue, RetentionPeriod: cdk.Duration_*Minutes(jsii.Number(30)), ScalingSteps: []scalingInterval{ &scalingInterval{ Change: jsii.Number(123), // the properties below are optional Lower: jsii.Number(123), Upper: jsii.Number(123), }, }, Secrets: map[string]*secret{ "secretsKey": secret, }, ServiceName: jsii.String("serviceName"), VisibilityTimeout: cdk.Duration_*Minutes(jsii.Number(30)), Vpc: vpc, }
type ScheduledEc2Task ¶
type ScheduledEc2Task interface { ScheduledTaskBase // The name of the cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. DesiredTaskCount() *float64 // The CloudWatch Events rule for the service. EventRule() awsevents.Rule // The tree node. Node() constructs.Node // Specifies whether to propagate the tags from the task definition to the task. // // If no value is specified, the tags are not propagated. // Default: - Tags will not be propagated. // PropagateTags() awsecs.PropagatedTagSource // In what subnets to place the task's ENIs. // // (Only applicable in case the TaskDefinition is configured for AwsVpc networking). // Default: Private subnets. // SubnetSelection() *awsec2.SubnetSelection // The metadata that you apply to the task to help you categorize and organize them. // // Each tag consists of a key and an optional value, both of which you define. // Default: - No tags are applied to the task. // Tags() *[]*awseventstargets.Tag // The ECS task in this construct. Task() awseventstargets.EcsTask // The EC2 task definition in this construct. TaskDefinition() awsecs.Ec2TaskDefinition // Adds task as a target of the scheduled event rule. AddTaskAsTarget(ecsTaskTarget awseventstargets.EcsTask) // Create an ECS task using the task definition provided and add it to the scheduled event rule. AddTaskDefinitionToEventTarget(taskDefinition awsecs.TaskDefinition) awseventstargets.EcsTask // Create an AWS Log Driver with the provided streamPrefix. CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Returns a string representation of this construct. ToString() *string }
A scheduled EC2 task that will be initiated off of CloudWatch Events.
Example:
// Instantiate an Amazon EC2 Task to run at a scheduled interval var cluster cluster ecsScheduledTask := ecsPatterns.NewScheduledEc2Task(this, jsii.String("ScheduledTask"), &ScheduledEc2TaskProps{ Cluster: Cluster, ScheduledEc2TaskImageOptions: &ScheduledEc2TaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), MemoryLimitMiB: jsii.Number(256), Environment: map[string]*string{ "name": jsii.String("TRIGGER"), "value": jsii.String("CloudWatch Events"), }, }, Schedule: appscaling.Schedule_Expression(jsii.String("rate(1 minute)")), Enabled: jsii.Boolean(true), RuleName: jsii.String("sample-scheduled-task-rule"), })
func NewScheduledEc2Task ¶
func NewScheduledEc2Task(scope constructs.Construct, id *string, props *ScheduledEc2TaskProps) ScheduledEc2Task
Constructs a new instance of the ScheduledEc2Task class.
type ScheduledEc2TaskDefinitionOptions ¶
type ScheduledEc2TaskDefinitionOptions struct { // The task definition to use for tasks in the service. One of image or taskDefinition must be specified. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.Ec2TaskDefinition `field:"required" json:"taskDefinition" yaml:"taskDefinition"` }
The properties for the ScheduledEc2Task using a task definition.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var ec2TaskDefinition ec2TaskDefinition scheduledEc2TaskDefinitionOptions := &ScheduledEc2TaskDefinitionOptions{ TaskDefinition: ec2TaskDefinition, }
type ScheduledEc2TaskImageOptions ¶
type ScheduledEc2TaskImageOptions struct { // The image used to start a container. // // Image or taskDefinition must be specified, but not both. // Default: - none. // Image awsecs.ContainerImage `field:"required" json:"image" yaml:"image"` // The command that is passed to the container. // // If you provide a shell command as a single string, you have to quote command-line arguments. // Default: - CMD value built into container image. // Command *[]*string `field:"optional" json:"command" yaml:"command"` // Optional name for the container added. // Default: - ScheduledContainer. // ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` // The environment variables to pass to the container. // Default: none. // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The secret to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` // The minimum number of CPU units to reserve for the container. // Default: none. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The hard limit (in MiB) of memory to present to the container. // // If your container attempts to exceed the allocated memory, the container // is terminated. // // At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services. // Default: - No memory limit. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // The soft limit (in MiB) of memory to reserve for the container. // // When system memory is under contention, Docker attempts to keep the // container memory within the limit. If the container requires more memory, // it can consume up to the value specified by the Memory property or all of // the available memory on the container instance—whichever comes first. // // At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services. // Default: - No memory reserved. // MemoryReservationMiB *float64 `field:"optional" json:"memoryReservationMiB" yaml:"memoryReservationMiB"` }
The properties for the ScheduledEc2Task using an image.
Example:
// Instantiate an Amazon EC2 Task to run at a scheduled interval var cluster cluster ecsScheduledTask := ecsPatterns.NewScheduledEc2Task(this, jsii.String("ScheduledTask"), &ScheduledEc2TaskProps{ Cluster: Cluster, ScheduledEc2TaskImageOptions: &ScheduledEc2TaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), MemoryLimitMiB: jsii.Number(256), Environment: map[string]*string{ "name": jsii.String("TRIGGER"), "value": jsii.String("CloudWatch Events"), }, }, Schedule: appscaling.Schedule_Expression(jsii.String("rate(1 minute)")), Enabled: jsii.Boolean(true), RuleName: jsii.String("sample-scheduled-task-rule"), })
type ScheduledEc2TaskProps ¶
type ScheduledEc2TaskProps struct { // The schedule or rate (frequency) that determines when CloudWatch Events runs the rule. // // For more information, see // [Schedule Expression Syntax for Rules](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html) // in the Amazon CloudWatch User Guide. Schedule awsapplicationautoscaling.Schedule `field:"required" json:"schedule" yaml:"schedule"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The desired number of instantiations of the task definition to keep running on the service. // Default: 1. // DesiredTaskCount *float64 `field:"optional" json:"desiredTaskCount" yaml:"desiredTaskCount"` // Indicates whether the rule is enabled. // Default: true. // Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"` // Specifies whether to propagate the tags from the task definition to the task. // // If no value is specified, the tags are not propagated. // Default: - Tags will not be propagated. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // A name for the rule. // Default: - AWS CloudFormation generates a unique physical ID and uses that ID // for the rule name. For more information, see [Name Type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html). // RuleName *string `field:"optional" json:"ruleName" yaml:"ruleName"` // Existing security groups to use for your service. // Default: - a new security group will be created. // SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // In what subnets to place the task's ENIs. // // (Only applicable in case the TaskDefinition is configured for AwsVpc networking). // Default: Private subnets. // SubnetSelection *awsec2.SubnetSelection `field:"optional" json:"subnetSelection" yaml:"subnetSelection"` // The metadata that you apply to the task to help you categorize and organize them. // // Each tag consists of a key and an optional value, both of which you define. // Default: - No tags are applied to the task. // Tags *[]*awseventstargets.Tag `field:"optional" json:"tags" yaml:"tags"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The properties to define if using an existing TaskDefinition in this construct. // // ScheduledEc2TaskDefinitionOptions or ScheduledEc2TaskImageOptions must be defined, but not both. // Default: none. // ScheduledEc2TaskDefinitionOptions *ScheduledEc2TaskDefinitionOptions `field:"optional" json:"scheduledEc2TaskDefinitionOptions" yaml:"scheduledEc2TaskDefinitionOptions"` // The properties to define if the construct is to create a TaskDefinition. // // ScheduledEc2TaskDefinitionOptions or ScheduledEc2TaskImageOptions must be defined, but not both. // Default: none. // ScheduledEc2TaskImageOptions *ScheduledEc2TaskImageOptions `field:"optional" json:"scheduledEc2TaskImageOptions" yaml:"scheduledEc2TaskImageOptions"` }
The properties for the ScheduledEc2Task task.
Example:
// Instantiate an Amazon EC2 Task to run at a scheduled interval var cluster cluster ecsScheduledTask := ecsPatterns.NewScheduledEc2Task(this, jsii.String("ScheduledTask"), &ScheduledEc2TaskProps{ Cluster: Cluster, ScheduledEc2TaskImageOptions: &ScheduledEc2TaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), MemoryLimitMiB: jsii.Number(256), Environment: map[string]*string{ "name": jsii.String("TRIGGER"), "value": jsii.String("CloudWatch Events"), }, }, Schedule: appscaling.Schedule_Expression(jsii.String("rate(1 minute)")), Enabled: jsii.Boolean(true), RuleName: jsii.String("sample-scheduled-task-rule"), })
type ScheduledFargateTask ¶
type ScheduledFargateTask interface { ScheduledTaskBase // The name of the cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. DesiredTaskCount() *float64 // The CloudWatch Events rule for the service. EventRule() awsevents.Rule // The tree node. Node() constructs.Node // Specifies whether to propagate the tags from the task definition to the task. // // If no value is specified, the tags are not propagated. // Default: - Tags will not be propagated. // PropagateTags() awsecs.PropagatedTagSource // In what subnets to place the task's ENIs. // // (Only applicable in case the TaskDefinition is configured for AwsVpc networking). // Default: Private subnets. // SubnetSelection() *awsec2.SubnetSelection // The metadata that you apply to the task to help you categorize and organize them. // // Each tag consists of a key and an optional value, both of which you define. // Default: - No tags are applied to the task. // Tags() *[]*awseventstargets.Tag // The ECS task in this construct. Task() awseventstargets.EcsTask // The Fargate task definition in this construct. TaskDefinition() awsecs.FargateTaskDefinition // Adds task as a target of the scheduled event rule. AddTaskAsTarget(ecsTaskTarget awseventstargets.EcsTask) // Create an ECS task using the task definition provided and add it to the scheduled event rule. AddTaskDefinitionToEventTarget(taskDefinition awsecs.TaskDefinition) awseventstargets.EcsTask // Create an AWS Log Driver with the provided streamPrefix. CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Returns a string representation of this construct. ToString() *string }
A scheduled Fargate task that will be initiated off of CloudWatch Events.
Example:
vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{ MaxAzs: jsii.Number(1), }) cluster := ecs.NewCluster(this, jsii.String("EcsCluster"), &ClusterProps{ Vpc: Vpc, }) scheduledFargateTask := ecsPatterns.NewScheduledFargateTask(this, jsii.String("ScheduledFargateTask"), &ScheduledFargateTaskProps{ Cluster: Cluster, ScheduledFargateTaskImageOptions: &ScheduledFargateTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), MemoryLimitMiB: jsii.Number(512), }, Schedule: appscaling.Schedule_Expression(jsii.String("rate(1 minute)")), Tags: []tag{ &tag{ Key: jsii.String("my-tag"), Value: jsii.String("my-tag-value"), }, }, })
func NewScheduledFargateTask ¶
func NewScheduledFargateTask(scope constructs.Construct, id *string, props *ScheduledFargateTaskProps) ScheduledFargateTask
Constructs a new instance of the ScheduledFargateTask class.
type ScheduledFargateTaskDefinitionOptions ¶
type ScheduledFargateTaskDefinitionOptions struct { // The task definition to use for tasks in the service. Image or taskDefinition must be specified, but not both. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.FargateTaskDefinition `field:"required" json:"taskDefinition" yaml:"taskDefinition"` }
The properties for the ScheduledFargateTask using a task definition.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var fargateTaskDefinition fargateTaskDefinition scheduledFargateTaskDefinitionOptions := &ScheduledFargateTaskDefinitionOptions{ TaskDefinition: fargateTaskDefinition, }
type ScheduledFargateTaskImageOptions ¶
type ScheduledFargateTaskImageOptions struct { // The image used to start a container. // // Image or taskDefinition must be specified, but not both. // Default: - none. // Image awsecs.ContainerImage `field:"required" json:"image" yaml:"image"` // The command that is passed to the container. // // If you provide a shell command as a single string, you have to quote command-line arguments. // Default: - CMD value built into container image. // Command *[]*string `field:"optional" json:"command" yaml:"command"` // Optional name for the container added. // Default: - ScheduledContainer. // ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` // The environment variables to pass to the container. // Default: none. // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The secret to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments // // 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: 256. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in GiB) of ephemeral storage to be allocated to the task. // // The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. // // Only supported in Fargate platform version 1.4.0 or later. // Default: Undefined, in which case, the task will receive 20GiB ephemeral storage. // EphemeralStorageGiB *float64 `field:"optional" json:"ephemeralStorageGiB" yaml:"ephemeralStorageGiB"` // The amount (in MiB) of memory used by the task. // // This field is required and you must use one of the following values, which determines your range of valid values // for the cpu parameter: // // 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) // // 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) // // 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) // // Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) // // Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) // // Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) // // Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) // // This default is set in the underlying FargateTaskDefinition construct. // Default: 512. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // 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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) // in the Amazon Elastic Container Service Developer Guide. // Default: Latest. // PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // The runtime platform of the task definition. // Default: - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64. // RuntimePlatform *awsecs.RuntimePlatform `field:"optional" json:"runtimePlatform" yaml:"runtimePlatform"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.FargateTaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` }
The properties for the ScheduledFargateTask using an image.
Example:
var cluster cluster scheduledFargateTask := ecsPatterns.NewScheduledFargateTask(this, jsii.String("ScheduledFargateTask"), &ScheduledFargateTaskProps{ Cluster: Cluster, ScheduledFargateTaskImageOptions: &ScheduledFargateTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), ContainerName: jsii.String("customContainerName"), MemoryLimitMiB: jsii.Number(512), }, Schedule: appscaling.Schedule_Expression(jsii.String("rate(1 minute)")), PlatformVersion: ecs.FargatePlatformVersion_LATEST, })
type ScheduledFargateTaskProps ¶
type ScheduledFargateTaskProps struct { // The schedule or rate (frequency) that determines when CloudWatch Events runs the rule. // // For more information, see // [Schedule Expression Syntax for Rules](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html) // in the Amazon CloudWatch User Guide. Schedule awsapplicationautoscaling.Schedule `field:"required" json:"schedule" yaml:"schedule"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The desired number of instantiations of the task definition to keep running on the service. // Default: 1. // DesiredTaskCount *float64 `field:"optional" json:"desiredTaskCount" yaml:"desiredTaskCount"` // Indicates whether the rule is enabled. // Default: true. // Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"` // Specifies whether to propagate the tags from the task definition to the task. // // If no value is specified, the tags are not propagated. // Default: - Tags will not be propagated. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // A name for the rule. // Default: - AWS CloudFormation generates a unique physical ID and uses that ID // for the rule name. For more information, see [Name Type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html). // RuleName *string `field:"optional" json:"ruleName" yaml:"ruleName"` // Existing security groups to use for your service. // Default: - a new security group will be created. // SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // In what subnets to place the task's ENIs. // // (Only applicable in case the TaskDefinition is configured for AwsVpc networking). // Default: Private subnets. // SubnetSelection *awsec2.SubnetSelection `field:"optional" json:"subnetSelection" yaml:"subnetSelection"` // The metadata that you apply to the task to help you categorize and organize them. // // Each tag consists of a key and an optional value, both of which you define. // Default: - No tags are applied to the task. // Tags *[]*awseventstargets.Tag `field:"optional" json:"tags" yaml:"tags"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: // // 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB // // 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB // // 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB // // 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments // // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments // // 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments // // This default is set in the underlying FargateTaskDefinition construct. // Default: 256. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // The amount (in GiB) of ephemeral storage to be allocated to the task. // // The minimum supported value is `21` GiB and the maximum supported value is `200` GiB. // // Only supported in Fargate platform version 1.4.0 or later. // Default: Undefined, in which case, the task will receive 20GiB ephemeral storage. // EphemeralStorageGiB *float64 `field:"optional" json:"ephemeralStorageGiB" yaml:"ephemeralStorageGiB"` // The amount (in MiB) of memory used by the task. // // This field is required and you must use one of the following values, which determines your range of valid values // for the cpu parameter: // // 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) // // 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) // // 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) // // Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) // // Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) // // Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU) // // Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU) // // This default is set in the underlying FargateTaskDefinition construct. // Default: 512. // MemoryLimitMiB *float64 `field:"optional" json:"memoryLimitMiB" yaml:"memoryLimitMiB"` // 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](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) // in the Amazon Elastic Container Service Developer Guide. // Default: Latest. // PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // The runtime platform of the task definition. // Default: - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64. // RuntimePlatform *awsecs.RuntimePlatform `field:"optional" json:"runtimePlatform" yaml:"runtimePlatform"` // The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both. // // [disable-awslint:ref-via-interface]. // Default: - none. // TaskDefinition awsecs.FargateTaskDefinition `field:"optional" json:"taskDefinition" yaml:"taskDefinition"` // The properties to define if using an existing TaskDefinition in this construct. // // ScheduledFargateTaskDefinitionOptions or ScheduledFargateTaskImageOptions must be defined, but not both. // Default: none. // ScheduledFargateTaskDefinitionOptions *ScheduledFargateTaskDefinitionOptions `field:"optional" json:"scheduledFargateTaskDefinitionOptions" yaml:"scheduledFargateTaskDefinitionOptions"` // The properties to define if the construct is to create a TaskDefinition. // // ScheduledFargateTaskDefinitionOptions or ScheduledFargateTaskImageOptions must be defined, but not both. // Default: none. // ScheduledFargateTaskImageOptions *ScheduledFargateTaskImageOptions `field:"optional" json:"scheduledFargateTaskImageOptions" yaml:"scheduledFargateTaskImageOptions"` }
The properties for the ScheduledFargateTask task.
Example:
vpc := ec2.NewVpc(this, jsii.String("Vpc"), &VpcProps{ MaxAzs: jsii.Number(1), }) cluster := ecs.NewCluster(this, jsii.String("EcsCluster"), &ClusterProps{ Vpc: Vpc, }) scheduledFargateTask := ecsPatterns.NewScheduledFargateTask(this, jsii.String("ScheduledFargateTask"), &ScheduledFargateTaskProps{ Cluster: Cluster, ScheduledFargateTaskImageOptions: &ScheduledFargateTaskImageOptions{ Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")), MemoryLimitMiB: jsii.Number(512), }, Schedule: appscaling.Schedule_Expression(jsii.String("rate(1 minute)")), Tags: []tag{ &tag{ Key: jsii.String("my-tag"), Value: jsii.String("my-tag-value"), }, }, })
type ScheduledTaskBase ¶
type ScheduledTaskBase interface { constructs.Construct // The name of the cluster that hosts the service. Cluster() awsecs.ICluster // The desired number of instantiations of the task definition to keep running on the service. // // The minimum value is 1. DesiredTaskCount() *float64 // The CloudWatch Events rule for the service. EventRule() awsevents.Rule // The tree node. Node() constructs.Node // Specifies whether to propagate the tags from the task definition to the task. // // If no value is specified, the tags are not propagated. // Default: - Tags will not be propagated. // PropagateTags() awsecs.PropagatedTagSource // In what subnets to place the task's ENIs. // // (Only applicable in case the TaskDefinition is configured for AwsVpc networking). // Default: Private subnets. // SubnetSelection() *awsec2.SubnetSelection // The metadata that you apply to the task to help you categorize and organize them. // // Each tag consists of a key and an optional value, both of which you define. // Default: - No tags are applied to the task. // Tags() *[]*awseventstargets.Tag // Adds task as a target of the scheduled event rule. AddTaskAsTarget(ecsTaskTarget awseventstargets.EcsTask) // Create an ECS task using the task definition provided and add it to the scheduled event rule. AddTaskDefinitionToEventTarget(taskDefinition awsecs.TaskDefinition) awseventstargets.EcsTask // Create an AWS Log Driver with the provided streamPrefix. CreateAWSLogDriver(prefix *string) awsecs.AwsLogDriver // Returns the default cluster. GetDefaultCluster(scope constructs.Construct, vpc awsec2.IVpc) awsecs.Cluster // Returns a string representation of this construct. ToString() *string }
The base class for ScheduledEc2Task and ScheduledFargateTask tasks.
type ScheduledTaskBaseProps ¶
type ScheduledTaskBaseProps struct { // The schedule or rate (frequency) that determines when CloudWatch Events runs the rule. // // For more information, see // [Schedule Expression Syntax for Rules](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html) // in the Amazon CloudWatch User Guide. Schedule awsapplicationautoscaling.Schedule `field:"required" json:"schedule" yaml:"schedule"` // The name of the cluster that hosts the service. // // If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc. // Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you. // Cluster awsecs.ICluster `field:"optional" json:"cluster" yaml:"cluster"` // The desired number of instantiations of the task definition to keep running on the service. // Default: 1. // DesiredTaskCount *float64 `field:"optional" json:"desiredTaskCount" yaml:"desiredTaskCount"` // Indicates whether the rule is enabled. // Default: true. // Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"` // Specifies whether to propagate the tags from the task definition to the task. // // If no value is specified, the tags are not propagated. // Default: - Tags will not be propagated. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // A name for the rule. // Default: - AWS CloudFormation generates a unique physical ID and uses that ID // for the rule name. For more information, see [Name Type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html). // RuleName *string `field:"optional" json:"ruleName" yaml:"ruleName"` // Existing security groups to use for your service. // Default: - a new security group will be created. // SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // In what subnets to place the task's ENIs. // // (Only applicable in case the TaskDefinition is configured for AwsVpc networking). // Default: Private subnets. // SubnetSelection *awsec2.SubnetSelection `field:"optional" json:"subnetSelection" yaml:"subnetSelection"` // The metadata that you apply to the task to help you categorize and organize them. // // Each tag consists of a key and an optional value, both of which you define. // Default: - No tags are applied to the task. // Tags *[]*awseventstargets.Tag `field:"optional" json:"tags" yaml:"tags"` // The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. // // If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster. // Default: - uses the VPC defined in the cluster or creates a new VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` }
The properties for the base ScheduledEc2Task or ScheduledFargateTask task.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var cluster cluster var schedule schedule var securityGroup securityGroup var subnet subnet var subnetFilter subnetFilter var vpc vpc scheduledTaskBaseProps := &ScheduledTaskBaseProps{ Schedule: schedule, // the properties below are optional Cluster: cluster, DesiredTaskCount: jsii.Number(123), Enabled: jsii.Boolean(false), PropagateTags: awscdk.Aws_ecs.PropagatedTagSource_SERVICE, RuleName: jsii.String("ruleName"), SecurityGroups: []iSecurityGroup{ securityGroup, }, SubnetSelection: &SubnetSelection{ AvailabilityZones: []*string{ jsii.String("availabilityZones"), }, OnePerAz: jsii.Boolean(false), SubnetFilters: []*subnetFilter{ subnetFilter, }, SubnetGroupName: jsii.String("subnetGroupName"), Subnets: []iSubnet{ subnet, }, SubnetType: awscdk.Aws_ec2.SubnetType_PRIVATE_ISOLATED, }, Tags: []tag{ &tag{ Key: jsii.String("key"), Value: jsii.String("value"), }, }, Vpc: vpc, }
type ScheduledTaskImageProps ¶
type ScheduledTaskImageProps struct { // The image used to start a container. // // Image or taskDefinition must be specified, but not both. // Default: - none. // Image awsecs.ContainerImage `field:"required" json:"image" yaml:"image"` // The command that is passed to the container. // // If you provide a shell command as a single string, you have to quote command-line arguments. // Default: - CMD value built into container image. // Command *[]*string `field:"optional" json:"command" yaml:"command"` // Optional name for the container added. // Default: - ScheduledContainer. // ContainerName *string `field:"optional" json:"containerName" yaml:"containerName"` // The environment variables to pass to the container. // Default: none. // Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"` // The log driver to use. // Default: - AwsLogDriver if enableLogging is true. // LogDriver awsecs.LogDriver `field:"optional" json:"logDriver" yaml:"logDriver"` // The secret to expose to the container as an environment variable. // Default: - No secret environment variables. // Secrets *map[string]awsecs.Secret `field:"optional" json:"secrets" yaml:"secrets"` }
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var containerImage containerImage var logDriver logDriver var secret secret scheduledTaskImageProps := &ScheduledTaskImageProps{ Image: containerImage, // the properties below are optional Command: []*string{ jsii.String("command"), }, ContainerName: jsii.String("containerName"), Environment: map[string]*string{ "environmentKey": jsii.String("environment"), }, LogDriver: logDriver, Secrets: map[string]*secret{ "secretsKey": secret, }, }
Source Files ¶
- ApplicationListenerProps.go
- ApplicationLoadBalancedEc2Service.go
- ApplicationLoadBalancedEc2ServiceProps.go
- ApplicationLoadBalancedEc2Service__checks.go
- ApplicationLoadBalancedFargateService.go
- ApplicationLoadBalancedFargateServiceProps.go
- ApplicationLoadBalancedFargateService__checks.go
- ApplicationLoadBalancedServiceBase.go
- ApplicationLoadBalancedServiceBaseProps.go
- ApplicationLoadBalancedServiceBase__checks.go
- ApplicationLoadBalancedServiceRecordType.go
- ApplicationLoadBalancedTaskImageOptions.go
- ApplicationLoadBalancedTaskImageProps.go
- ApplicationLoadBalancerProps.go
- ApplicationMultipleTargetGroupsEc2Service.go
- ApplicationMultipleTargetGroupsEc2ServiceProps.go
- ApplicationMultipleTargetGroupsEc2Service__checks.go
- ApplicationMultipleTargetGroupsFargateService.go
- ApplicationMultipleTargetGroupsFargateServiceProps.go
- ApplicationMultipleTargetGroupsFargateService__checks.go
- ApplicationMultipleTargetGroupsServiceBase.go
- ApplicationMultipleTargetGroupsServiceBaseProps.go
- ApplicationMultipleTargetGroupsServiceBase__checks.go
- ApplicationTargetProps.go
- FargateServiceBaseProps.go
- NetworkListenerProps.go
- NetworkLoadBalancedEc2Service.go
- NetworkLoadBalancedEc2ServiceProps.go
- NetworkLoadBalancedEc2Service__checks.go
- NetworkLoadBalancedFargateService.go
- NetworkLoadBalancedFargateServiceProps.go
- NetworkLoadBalancedFargateService__checks.go
- NetworkLoadBalancedServiceBase.go
- NetworkLoadBalancedServiceBaseProps.go
- NetworkLoadBalancedServiceBase__checks.go
- NetworkLoadBalancedServiceRecordType.go
- NetworkLoadBalancedTaskImageOptions.go
- NetworkLoadBalancedTaskImageProps.go
- NetworkLoadBalancerProps.go
- NetworkMultipleTargetGroupsEc2Service.go
- NetworkMultipleTargetGroupsEc2ServiceProps.go
- NetworkMultipleTargetGroupsEc2Service__checks.go
- NetworkMultipleTargetGroupsFargateService.go
- NetworkMultipleTargetGroupsFargateServiceProps.go
- NetworkMultipleTargetGroupsFargateService__checks.go
- NetworkMultipleTargetGroupsServiceBase.go
- NetworkMultipleTargetGroupsServiceBaseProps.go
- NetworkMultipleTargetGroupsServiceBase__checks.go
- NetworkTargetProps.go
- QueueProcessingEc2Service.go
- QueueProcessingEc2ServiceProps.go
- QueueProcessingEc2Service__checks.go
- QueueProcessingFargateService.go
- QueueProcessingFargateServiceProps.go
- QueueProcessingFargateService__checks.go
- QueueProcessingServiceBase.go
- QueueProcessingServiceBaseProps.go
- QueueProcessingServiceBase__checks.go
- ScheduledEc2Task.go
- ScheduledEc2TaskDefinitionOptions.go
- ScheduledEc2TaskImageOptions.go
- ScheduledEc2TaskProps.go
- ScheduledEc2Task__checks.go
- ScheduledFargateTask.go
- ScheduledFargateTaskDefinitionOptions.go
- ScheduledFargateTaskImageOptions.go
- ScheduledFargateTaskProps.go
- ScheduledFargateTask__checks.go
- ScheduledTaskBase.go
- ScheduledTaskBaseProps.go
- ScheduledTaskBase__checks.go
- ScheduledTaskImageProps.go
- main.go