Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add CpuCredits parameter #976

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions templates/aws-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Metadata:
- ImageId
- ImageIdParameter
- InstanceType
- CpuCredits
- EnableInstanceStorage
- AgentsPerInstance
- KeyName
Expand Down Expand Up @@ -243,6 +244,13 @@ Parameters:
AllowedPattern: "^[\\w\\.]+(,[\\w\\.]*){0,3}$"
ConstraintDescription: "must contain 1-4 instance types separated by commas. No space before/after the comma."

CpuCredits:
Description: Credit option for CPU usage of the instance.
AllowedValues:
- standard
- unlimited
Default: "unlimited"

SpotPrice:
Description: Maximum spot price to use for the instances, in instance cost per hour. Values >0 will result in 100% of instances being spot. 0 means only use normal (non-spot) instances. This parameter is deprecated - we recommend setting to 0 and using OnDemandPercentage to opt into spot instances.
Type: String
Expand Down Expand Up @@ -931,6 +939,8 @@ Resources:
BlockDeviceMappings:
- DeviceName: !If [ UseDefaultRootVolumeName, !If [ UseWindowsAgents, /dev/sda1, /dev/xvda ], !Ref RootVolumeName ]
Ebs: { VolumeSize: !Ref RootVolumeSize, VolumeType: !Ref RootVolumeType }
CreditSpecification:
CpuCredits: !Ref CpuCredits
Comment on lines +942 to +943
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice the docs say:

The credit option for CPU usage of the instance. Valid for T2, T3, or T3a instances only.

Will the presence of this option break the LaunchTemplate for other instance types?
Or are they happy [as long as it's set to unlimited?]?

Copy link
Author

@TheDen TheDen Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'm not certain about this either. I tried to test it locally but couldn't get it working. The docs seem out of date since It would also work for t4g graviton instances

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a cleaner solution would be to conditionally add the CreditSpecification YAML key+value if InstanceType matches one of the supported EC2 types?

TagSpecifications:
- ResourceType: instance
Tags:
Expand Down