-
Notifications
You must be signed in to change notification settings - Fork 17
/
MixedInstancesPolicy.go
58 lines (55 loc) · 2.14 KB
/
MixedInstancesPolicy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package awsautoscaling
import (
"github.com/aws/aws-cdk-go/awscdk/v2/awsec2"
)
// MixedInstancesPolicy allows you to configure a group that diversifies across On-Demand Instances and Spot Instances of multiple instance types.
//
// For more information, see Auto Scaling groups with
// multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide:
//
// https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html
//
// Example:
// var vpc vpc
// var launchTemplate1 launchTemplate
// var launchTemplate2 launchTemplate
//
//
// autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{
// Vpc: Vpc,
// MixedInstancesPolicy: &MixedInstancesPolicy{
// InstancesDistribution: &InstancesDistribution{
// OnDemandPercentageAboveBaseCapacity: jsii.Number(50),
// },
// LaunchTemplate: launchTemplate1,
// LaunchTemplateOverrides: []launchTemplateOverrides{
// &launchTemplateOverrides{
// InstanceType: ec2.NewInstanceType(jsii.String("t3.micro")),
// },
// &launchTemplateOverrides{
// InstanceType: ec2.NewInstanceType(jsii.String("t3a.micro")),
// },
// &launchTemplateOverrides{
// InstanceType: ec2.NewInstanceType(jsii.String("t4g.micro")),
// LaunchTemplate: launchTemplate2,
// },
// },
// },
// })
//
type MixedInstancesPolicy struct {
// Launch template to use.
LaunchTemplate awsec2.ILaunchTemplate `field:"required" json:"launchTemplate" yaml:"launchTemplate"`
// InstancesDistribution to use.
// Default: - The value for each property in it uses a default value.
//
InstancesDistribution *InstancesDistribution `field:"optional" json:"instancesDistribution" yaml:"instancesDistribution"`
// Launch template overrides.
//
// The maximum number of instance types that can be associated with an Auto Scaling group is 40.
//
// The maximum number of distinct launch templates you can define for an Auto Scaling group is 20.
// Default: - Do not provide any overrides.
//
LaunchTemplateOverrides *[]*LaunchTemplateOverrides `field:"optional" json:"launchTemplateOverrides" yaml:"launchTemplateOverrides"`
}