Skip to content

Commit bf10da9

Browse files
author
awstools
committed
feat(client-batch): This feature allows override LaunchTemplates to be specified in an AWS Batch Compute Environment.
1 parent 43e848f commit bf10da9

File tree

6 files changed

+187
-8
lines changed

6 files changed

+187
-8
lines changed

clients/client-batch/src/commands/CreateComputeEnvironmentCommand.ts

+10
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ export interface CreateComputeEnvironmentCommandOutput extends CreateComputeEnvi
164164
* launchTemplateId: "STRING_VALUE",
165165
* launchTemplateName: "STRING_VALUE",
166166
* version: "STRING_VALUE",
167+
* overrides: [ // LaunchTemplateSpecificationOverrideList
168+
* { // LaunchTemplateSpecificationOverride
169+
* launchTemplateId: "STRING_VALUE",
170+
* launchTemplateName: "STRING_VALUE",
171+
* version: "STRING_VALUE",
172+
* targetInstanceTypes: [
173+
* "STRING_VALUE",
174+
* ],
175+
* },
176+
* ],
167177
* },
168178
* ec2Configuration: [ // Ec2ConfigurationList
169179
* { // Ec2Configuration

clients/client-batch/src/commands/DescribeComputeEnvironmentsCommand.ts

+10
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ export interface DescribeComputeEnvironmentsCommandOutput
9494
* // launchTemplateId: "STRING_VALUE",
9595
* // launchTemplateName: "STRING_VALUE",
9696
* // version: "STRING_VALUE",
97+
* // overrides: [ // LaunchTemplateSpecificationOverrideList
98+
* // { // LaunchTemplateSpecificationOverride
99+
* // launchTemplateId: "STRING_VALUE",
100+
* // launchTemplateName: "STRING_VALUE",
101+
* // version: "STRING_VALUE",
102+
* // targetInstanceTypes: [
103+
* // "STRING_VALUE",
104+
* // ],
105+
* // },
106+
* // ],
97107
* // },
98108
* // ec2Configuration: [ // Ec2ConfigurationList
99109
* // { // Ec2Configuration

clients/client-batch/src/commands/UpdateComputeEnvironmentCommand.ts

+10
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ export interface UpdateComputeEnvironmentCommandOutput extends UpdateComputeEnvi
6464
* launchTemplateId: "STRING_VALUE",
6565
* launchTemplateName: "STRING_VALUE",
6666
* version: "STRING_VALUE",
67+
* overrides: [ // LaunchTemplateSpecificationOverrideList
68+
* { // LaunchTemplateSpecificationOverride
69+
* launchTemplateId: "STRING_VALUE",
70+
* launchTemplateName: "STRING_VALUE",
71+
* version: "STRING_VALUE",
72+
* targetInstanceTypes: [
73+
* "STRING_VALUE",
74+
* ],
75+
* },
76+
* ],
6777
* },
6878
* ec2Configuration: [ // Ec2ConfigurationList
6979
* { // Ec2Configuration

clients/client-batch/src/models/models_0.ts

+103-7
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,90 @@ export interface Ec2Configuration {
450450
imageKubernetesVersion?: string;
451451
}
452452

453+
/**
454+
* <p>An object that represents a launch template to use in place of the default launch template. You must specify either the launch template ID or launch template name in the request, but not
455+
* both.</p>
456+
* <p>If security groups are specified using both the <code>securityGroupIds</code> parameter of
457+
* <code>CreateComputeEnvironment</code> and the launch template, the values in the
458+
* <code>securityGroupIds</code> parameter of <code>CreateComputeEnvironment</code> will be
459+
* used.</p>
460+
* <p>You can define up to ten (10) overrides for each compute environment.</p>
461+
* <note>
462+
* <p>This object isn't applicable to jobs that are running on Fargate resources.</p>
463+
* </note>
464+
* <note>
465+
* <p>To unset all override templates for a compute environment, you can pass an empty array to the <a href="https://docs.aws.amazon.com/batch/latest/APIReference/API_UpdateComputeEnvironment.html">UpdateComputeEnvironment.overrides</a> parameter, or not include the <code>overrides</code> parameter when submitting the <code>UpdateComputeEnvironment</code> API operation.</p>
466+
* </note>
467+
* @public
468+
*/
469+
export interface LaunchTemplateSpecificationOverride {
470+
/**
471+
* <p>The ID of the launch template.</p>
472+
* <p>
473+
* <b>Note:</b> If you specify the <code>launchTemplateId</code> you can't specify the <code>launchTemplateName</code> as well.</p>
474+
* @public
475+
*/
476+
launchTemplateId?: string;
477+
478+
/**
479+
* <p>The name of the launch template.</p>
480+
* <p>
481+
* <b>Note:</b> If you specify the <code>launchTemplateName</code> you can't specify the <code>launchTemplateId</code> as well.</p>
482+
* @public
483+
*/
484+
launchTemplateName?: string;
485+
486+
/**
487+
* <p>The version number of the launch template,
488+
* <code>$Default</code>, or <code>$Latest</code>.</p>
489+
* <p>If the value is <code>$Default</code>, the default version of the launch template is used. If the value is <code>$Latest</code>, the latest version of the launch template is used. </p>
490+
* <important>
491+
* <p>If the AMI ID that's used in a compute environment is from the launch template, the AMI
492+
* isn't changed when the compute environment is updated. It's only changed if the
493+
* <code>updateToLatestImageVersion</code> parameter for the compute environment is set to
494+
* <code>true</code>. During an infrastructure update, if either <code>$Default</code> or <code>$Latest</code> is specified, Batch re-evaluates the launch template version, and it
495+
* might use a different version of the launch template. This is the case even if the launch
496+
* template isn't specified in the update. When updating a compute environment, changing the launch
497+
* template requires an infrastructure update of the compute environment. For more information, see
498+
* <a href="https://docs.aws.amazon.com/batch/latest/userguide/updating-compute-environments.html">Updating compute
499+
* environments</a> in the <i>Batch User Guide</i>.</p>
500+
* </important>
501+
* <p>Default: <code>$Default</code>
502+
* </p>
503+
* <p>Latest: <code>$Latest</code>
504+
* </p>
505+
* @public
506+
*/
507+
version?: string;
508+
509+
/**
510+
* <p>The instance type or family that this this override launch template should be applied to.</p>
511+
* <p>This parameter is required when defining a launch template override.</p>
512+
* <p>Information included in this parameter must meet the following requirements:</p>
513+
* <ul>
514+
* <li>
515+
* <p>Must be a valid Amazon EC2 instance type or family.</p>
516+
* </li>
517+
* <li>
518+
* <p>
519+
* <code>optimal</code> isn't allowed.</p>
520+
* </li>
521+
* <li>
522+
* <p>
523+
* <code>targetInstanceTypes</code> can target only instance types and families that are included within the <a href="https://docs.aws.amazon.com/batch/latest/APIReference/API_ComputeResource.html#Batch-Type-ComputeResource-instanceTypes">
524+
* <code>ComputeResource.instanceTypes</code>
525+
* </a> set. <code>targetInstanceTypes</code> doesn't need to include all of the instances from the <code>instanceType</code> set, but at least a subset. For example, if <code>ComputeResource.instanceTypes</code> includes <code>[m5, g5]</code>, <code>targetInstanceTypes</code> can include <code>[m5.2xlarge]</code> and <code>[m5.large]</code> but not <code>[c5.large]</code>.</p>
526+
* </li>
527+
* <li>
528+
* <p>
529+
* <code>targetInstanceTypes</code> included within the same launch template override or across launch template overrides can't overlap for the same compute environment. For example, you can't define one launch template override to target an instance family and another define an instance type within this same family.</p>
530+
* </li>
531+
* </ul>
532+
* @public
533+
*/
534+
targetInstanceTypes?: string[];
535+
}
536+
453537
/**
454538
* <p>An object that represents a launch template that's associated with a compute resource. You
455539
* must specify either the launch template ID or launch template name in the request, but not
@@ -477,26 +561,38 @@ export interface LaunchTemplateSpecification {
477561
launchTemplateName?: string;
478562

479563
/**
480-
* <p>The version number of the launch template, <code>$Latest</code>, or
481-
* <code>$Default</code>.</p>
482-
* <p>If the value is <code>$Latest</code>, the latest version of the launch template is used. If
483-
* the value is <code>$Default</code>, the default version of the launch template is used.</p>
564+
* <p>The version number of the launch template,
565+
* <code>$Default</code>, or <code>$Latest</code>.</p>
566+
* <p>If the value is <code>$Default</code>, the default version of the launch template is used. If the value is <code>$Latest</code>, the latest version of the launch template is used. </p>
484567
* <important>
485568
* <p>If the AMI ID that's used in a compute environment is from the launch template, the AMI
486569
* isn't changed when the compute environment is updated. It's only changed if the
487570
* <code>updateToLatestImageVersion</code> parameter for the compute environment is set to
488-
* <code>true</code>. During an infrastructure update, if either <code>$Latest</code> or
489-
* <code>$Default</code> is specified, Batch re-evaluates the launch template version, and it
571+
* <code>true</code>. During an infrastructure update, if either <code>$Default</code> or
572+
* <code>$Latest</code> is specified, Batch re-evaluates the launch template version, and it
490573
* might use a different version of the launch template. This is the case even if the launch
491574
* template isn't specified in the update. When updating a compute environment, changing the launch
492575
* template requires an infrastructure update of the compute environment. For more information, see
493576
* <a href="https://docs.aws.amazon.com/batch/latest/userguide/updating-compute-environments.html">Updating compute
494577
* environments</a> in the <i>Batch User Guide</i>.</p>
495578
* </important>
496-
* <p>Default: <code>$Default</code>.</p>
579+
* <p>Default: <code>$Default</code>
580+
* </p>
581+
* <p>Latest: <code>$Latest</code>
582+
* </p>
497583
* @public
498584
*/
499585
version?: string;
586+
587+
/**
588+
* <p>A launch template to use in place of the default launch template. You must specify either the launch template ID or launch template name in the request, but not both.</p>
589+
* <p>You can specify up to ten (10) launch template overrides that are associated to unique instance types or families for each compute environment.</p>
590+
* <note>
591+
* <p>To unset all override templates for a compute environment, you can pass an empty array to the <a href="https://docs.aws.amazon.com/batch/latest/APIReference/API_UpdateComputeEnvironment.html">UpdateComputeEnvironment.overrides</a> parameter, or not include the <code>overrides</code> parameter when submitting the <code>UpdateComputeEnvironment</code> API operation.</p>
592+
* </note>
593+
* @public
594+
*/
595+
overrides?: LaunchTemplateSpecificationOverride[];
500596
}
501597

502598
/**

clients/client-batch/src/protocols/Aws_restJson1.ts

+9
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ import {
140140
KeyValuePair,
141141
KeyValuesPair,
142142
LaunchTemplateSpecification,
143+
LaunchTemplateSpecificationOverride,
143144
LinuxParameters,
144145
LogConfiguration,
145146
MountPoint,
@@ -1470,6 +1471,10 @@ const se_FairsharePolicy = (input: FairsharePolicy, context: __SerdeContext): an
14701471

14711472
// se_LaunchTemplateSpecification omitted.
14721473

1474+
// se_LaunchTemplateSpecificationOverride omitted.
1475+
1476+
// se_LaunchTemplateSpecificationOverrideList omitted.
1477+
14731478
// se_LinuxParameters omitted.
14741479

14751480
// se_ListEcsTaskProperties omitted.
@@ -1842,6 +1847,10 @@ const de_JobDetailList = (output: any, context: __SerdeContext): JobDetail[] =>
18421847

18431848
// de_LaunchTemplateSpecification omitted.
18441849

1850+
// de_LaunchTemplateSpecificationOverride omitted.
1851+
1852+
// de_LaunchTemplateSpecificationOverrideList omitted.
1853+
18451854
// de_LinuxParameters omitted.
18461855

18471856
// de_ListAttemptEcsTaskDetails omitted.

0 commit comments

Comments
 (0)