Skip to content

Commit

Permalink
feat(aws-autoscaling): allow setting spotPrice
Browse files Browse the repository at this point in the history
Fixes #2208.
  • Loading branch information
SoManyHs committed May 23, 2019
1 parent 9b4db42 commit c321d2d
Show file tree
Hide file tree
Showing 6 changed files with 548 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ export interface AutoScalingGroupProps extends CommonAutoScalingGroupProps {
* @default A role will automatically be created, it can be accessed via the `role` property
*/
readonly role?: iam.IRole;

/**
* The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are
* launched when the price you specify exceeds the current Spot market price.
*
* @default none
*/
readonly spotPrice?: string;
}

abstract class AutoScalingGroupBase extends Resource implements IAutoScalingGroup {
Expand Down Expand Up @@ -378,6 +386,7 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements
iamInstanceProfile: iamProfile.ref,
userData: userDataToken,
associatePublicIpAddress: props.associatePublicIpAddress,
spotPrice: props.spotPrice,
});

launchConfig.node.addDependency(this.role);
Expand Down
Loading

0 comments on commit c321d2d

Please sign in to comment.