Skip to content

Commit

Permalink
feat(client-batch): This feature allows override LaunchTemplates to b…
Browse files Browse the repository at this point in the history
…e specified in an AWS Batch Compute Environment.
  • Loading branch information
awstools committed Nov 8, 2024
1 parent 43e848f commit bf10da9
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ export interface CreateComputeEnvironmentCommandOutput extends CreateComputeEnvi
* launchTemplateId: "STRING_VALUE",
* launchTemplateName: "STRING_VALUE",
* version: "STRING_VALUE",
* overrides: [ // LaunchTemplateSpecificationOverrideList
* { // LaunchTemplateSpecificationOverride
* launchTemplateId: "STRING_VALUE",
* launchTemplateName: "STRING_VALUE",
* version: "STRING_VALUE",
* targetInstanceTypes: [
* "STRING_VALUE",
* ],
* },
* ],
* },
* ec2Configuration: [ // Ec2ConfigurationList
* { // Ec2Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ export interface DescribeComputeEnvironmentsCommandOutput
* // launchTemplateId: "STRING_VALUE",
* // launchTemplateName: "STRING_VALUE",
* // version: "STRING_VALUE",
* // overrides: [ // LaunchTemplateSpecificationOverrideList
* // { // LaunchTemplateSpecificationOverride
* // launchTemplateId: "STRING_VALUE",
* // launchTemplateName: "STRING_VALUE",
* // version: "STRING_VALUE",
* // targetInstanceTypes: [
* // "STRING_VALUE",
* // ],
* // },
* // ],
* // },
* // ec2Configuration: [ // Ec2ConfigurationList
* // { // Ec2Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ export interface UpdateComputeEnvironmentCommandOutput extends UpdateComputeEnvi
* launchTemplateId: "STRING_VALUE",
* launchTemplateName: "STRING_VALUE",
* version: "STRING_VALUE",
* overrides: [ // LaunchTemplateSpecificationOverrideList
* { // LaunchTemplateSpecificationOverride
* launchTemplateId: "STRING_VALUE",
* launchTemplateName: "STRING_VALUE",
* version: "STRING_VALUE",
* targetInstanceTypes: [
* "STRING_VALUE",
* ],
* },
* ],
* },
* ec2Configuration: [ // Ec2ConfigurationList
* { // Ec2Configuration
Expand Down
110 changes: 103 additions & 7 deletions clients/client-batch/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,90 @@ export interface Ec2Configuration {
imageKubernetesVersion?: string;
}

/**
* <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
* both.</p>
* <p>If security groups are specified using both the <code>securityGroupIds</code> parameter of
* <code>CreateComputeEnvironment</code> and the launch template, the values in the
* <code>securityGroupIds</code> parameter of <code>CreateComputeEnvironment</code> will be
* used.</p>
* <p>You can define up to ten (10) overrides for each compute environment.</p>
* <note>
* <p>This object isn't applicable to jobs that are running on Fargate resources.</p>
* </note>
* <note>
* <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>
* </note>
* @public
*/
export interface LaunchTemplateSpecificationOverride {
/**
* <p>The ID of the launch template.</p>
* <p>
* <b>Note:</b> If you specify the <code>launchTemplateId</code> you can't specify the <code>launchTemplateName</code> as well.</p>
* @public
*/
launchTemplateId?: string;

/**
* <p>The name of the launch template.</p>
* <p>
* <b>Note:</b> If you specify the <code>launchTemplateName</code> you can't specify the <code>launchTemplateId</code> as well.</p>
* @public
*/
launchTemplateName?: string;

/**
* <p>The version number of the launch template,
* <code>$Default</code>, or <code>$Latest</code>.</p>
* <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>
* <important>
* <p>If the AMI ID that's used in a compute environment is from the launch template, the AMI
* isn't changed when the compute environment is updated. It's only changed if the
* <code>updateToLatestImageVersion</code> parameter for the compute environment is set to
* <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
* might use a different version of the launch template. This is the case even if the launch
* template isn't specified in the update. When updating a compute environment, changing the launch
* template requires an infrastructure update of the compute environment. For more information, see
* <a href="https://docs.aws.amazon.com/batch/latest/userguide/updating-compute-environments.html">Updating compute
* environments</a> in the <i>Batch User Guide</i>.</p>
* </important>
* <p>Default: <code>$Default</code>
* </p>
* <p>Latest: <code>$Latest</code>
* </p>
* @public
*/
version?: string;

/**
* <p>The instance type or family that this this override launch template should be applied to.</p>
* <p>This parameter is required when defining a launch template override.</p>
* <p>Information included in this parameter must meet the following requirements:</p>
* <ul>
* <li>
* <p>Must be a valid Amazon EC2 instance type or family.</p>
* </li>
* <li>
* <p>
* <code>optimal</code> isn't allowed.</p>
* </li>
* <li>
* <p>
* <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">
* <code>ComputeResource.instanceTypes</code>
* </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>
* </li>
* <li>
* <p>
* <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>
* </li>
* </ul>
* @public
*/
targetInstanceTypes?: string[];
}

/**
* <p>An object that represents a launch template that's associated with a compute resource. You
* must specify either the launch template ID or launch template name in the request, but not
Expand Down Expand Up @@ -477,26 +561,38 @@ export interface LaunchTemplateSpecification {
launchTemplateName?: string;

/**
* <p>The version number of the launch template, <code>$Latest</code>, or
* <code>$Default</code>.</p>
* <p>If the value is <code>$Latest</code>, the latest version of the launch template is used. If
* the value is <code>$Default</code>, the default version of the launch template is used.</p>
* <p>The version number of the launch template,
* <code>$Default</code>, or <code>$Latest</code>.</p>
* <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>
* <important>
* <p>If the AMI ID that's used in a compute environment is from the launch template, the AMI
* isn't changed when the compute environment is updated. It's only changed if the
* <code>updateToLatestImageVersion</code> parameter for the compute environment is set to
* <code>true</code>. During an infrastructure update, if either <code>$Latest</code> or
* <code>$Default</code> is specified, Batch re-evaluates the launch template version, and it
* <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
* might use a different version of the launch template. This is the case even if the launch
* template isn't specified in the update. When updating a compute environment, changing the launch
* template requires an infrastructure update of the compute environment. For more information, see
* <a href="https://docs.aws.amazon.com/batch/latest/userguide/updating-compute-environments.html">Updating compute
* environments</a> in the <i>Batch User Guide</i>.</p>
* </important>
* <p>Default: <code>$Default</code>.</p>
* <p>Default: <code>$Default</code>
* </p>
* <p>Latest: <code>$Latest</code>
* </p>
* @public
*/
version?: string;

/**
* <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>
* <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>
* <note>
* <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>
* </note>
* @public
*/
overrides?: LaunchTemplateSpecificationOverride[];
}

/**
Expand Down
9 changes: 9 additions & 0 deletions clients/client-batch/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ import {
KeyValuePair,
KeyValuesPair,
LaunchTemplateSpecification,
LaunchTemplateSpecificationOverride,
LinuxParameters,
LogConfiguration,
MountPoint,
Expand Down Expand Up @@ -1470,6 +1471,10 @@ const se_FairsharePolicy = (input: FairsharePolicy, context: __SerdeContext): an

// se_LaunchTemplateSpecification omitted.

// se_LaunchTemplateSpecificationOverride omitted.

// se_LaunchTemplateSpecificationOverrideList omitted.

// se_LinuxParameters omitted.

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

// de_LaunchTemplateSpecification omitted.

// de_LaunchTemplateSpecificationOverride omitted.

// de_LaunchTemplateSpecificationOverrideList omitted.

// de_LinuxParameters omitted.

// de_ListAttemptEcsTaskDetails omitted.
Expand Down
Loading

0 comments on commit bf10da9

Please sign in to comment.