Skip to content

Commit 097a389

Browse files
author
awstools
committed
feat(client-ec2): Stop Protection feature enables customers to protect their instances from accidental stop actions.
1 parent 0035863 commit 097a389

File tree

9 files changed

+133
-37
lines changed

9 files changed

+133
-37
lines changed

clients/client-ec2/src/EC2.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5205,7 +5205,7 @@ export class EC2 extends EC2Client {
52055205
* <p>A launch template contains the parameters to launch an
52065206
* instance. When you launch an instance using <a>RunInstances</a>, you can
52075207
* specify a launch template instead of providing the launch parameters in the request. For
5208-
* more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html">Launching an instance from a
5208+
* more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html">Launch an instance from a
52095209
* launch template</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
52105210
* <p>If you want to clone an existing launch template as the basis for creating a new
52115211
* launch template, you can use the Amazon EC2 console. The API, SDKs, and CLI do not support
@@ -5246,7 +5246,9 @@ export class EC2 extends EC2Client {
52465246
* launch template from which to base the new version.</p>
52475247
* <p>Launch template versions are numbered in the order in which they are created. You
52485248
* cannot specify, change, or replace the numbering of launch template versions.</p>
5249-
* <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html#manage-launch-template-versions">Managing launch template versions</a>in the
5249+
* <p>Launch templates are immutable; after you create a launch template, you can't modify it.
5250+
* Instead, you can create a new version of the launch template that includes any changes you require.</p>
5251+
* <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html#manage-launch-template-versions">Modify a launch template (manage launch template versions)</a>in the
52505252
* <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
52515253
*/
52525254
public createLaunchTemplateVersion(

clients/client-ec2/src/commands/CreateLaunchTemplateCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface CreateLaunchTemplateCommandOutput extends CreateLaunchTemplateR
2727
* <p>A launch template contains the parameters to launch an
2828
* instance. When you launch an instance using <a>RunInstances</a>, you can
2929
* specify a launch template instead of providing the launch parameters in the request. For
30-
* more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html">Launching an instance from a
30+
* more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html">Launch an instance from a
3131
* launch template</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
3232
* <p>If you want to clone an existing launch template as the basis for creating a new
3333
* launch template, you can use the Amazon EC2 console. The API, SDKs, and CLI do not support

clients/client-ec2/src/commands/CreateLaunchTemplateVersionCommand.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export interface CreateLaunchTemplateVersionCommandOutput extends CreateLaunchTe
2727
* launch template from which to base the new version.</p>
2828
* <p>Launch template versions are numbered in the order in which they are created. You
2929
* cannot specify, change, or replace the numbering of launch template versions.</p>
30-
* <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html#manage-launch-template-versions">Managing launch template versions</a>in the
30+
* <p>Launch templates are immutable; after you create a launch template, you can't modify it.
31+
* Instead, you can create a new version of the launch template that includes any changes you require.</p>
32+
* <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html#manage-launch-template-versions">Modify a launch template (manage launch template versions)</a>in the
3133
* <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
3234
* @example
3335
* Use a bare-bones client and the command you need to make an API call.

clients/client-ec2/src/models/models_1.ts

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3853,7 +3853,7 @@ export namespace LaunchTemplateElasticInferenceAccelerator {
38533853

38543854
/**
38553855
* <p>Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. For more
3856-
* information, see <a href="https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html"> What is Amazon Web Services Nitro Enclaves?</a>
3856+
* information, see <a href="https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html">What is Amazon Web Services Nitro Enclaves?</a>
38573857
* in the <i>Amazon Web Services Nitro Enclaves User Guide</i>.</p>
38583858
*/
38593859
export interface LaunchTemplateEnclaveOptionsRequest {
@@ -3875,7 +3875,7 @@ export namespace LaunchTemplateEnclaveOptionsRequest {
38753875

38763876
/**
38773877
* <p>Indicates whether the instance is configured for hibernation. This parameter is valid
3878-
* only if the instance meets the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites">hibernation
3878+
* only if the instance meets the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html">hibernation
38793879
* prerequisites</a>.</p>
38803880
*/
38813881
export interface LaunchTemplateHibernationOptionsRequest {
@@ -4487,9 +4487,8 @@ export interface RequestLaunchTemplateData {
44874487
* <p>The ID of the kernel.</p>
44884488
* <important>
44894489
* <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more
4490-
* information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">User Provided
4491-
* Kernels</a> in the <i>Amazon Elastic Compute Cloud User
4492-
* Guide</i>.</p>
4490+
* information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">User provided
4491+
* kernels</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
44934492
* </important>
44944493
*/
44954494
KernelId?: string;
@@ -4525,7 +4524,7 @@ export interface RequestLaunchTemplateData {
45254524
ImageId?: string;
45264525

45274526
/**
4528-
* <p>The instance type. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html">Instance Types</a> in the
4527+
* <p>The instance type. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html">Instance types</a> in the
45294528
* <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
45304529
* <p>If you specify <code>InstanceTypes</code>, you can't specify
45314530
* <code>InstanceRequirements</code>.</p>
@@ -4556,9 +4555,8 @@ export interface RequestLaunchTemplateData {
45564555
* <p>The ID of the RAM disk.</p>
45574556
* <important>
45584557
* <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more
4559-
* information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">User Provided
4560-
* Kernels</a> in the <i>Amazon Elastic Compute Cloud User
4561-
* Guide</i>.</p>
4558+
* information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">User provided
4559+
* kernels</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
45624560
* </important>
45634561
*/
45644562
RamDiskId?: string;
@@ -4582,8 +4580,8 @@ export interface RequestLaunchTemplateData {
45824580

45834581
/**
45844582
* <p>The user data to make available to the instance. You must provide base64-encoded text.
4585-
* User data is limited to 16 KB. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Running Commands on Your Linux Instance
4586-
* at Launch</a> (Linux) or <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data">Adding User Data</a> (Windows).</p>
4583+
* User data is limited to 16 KB. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Run commands on your Linux instance
4584+
* at launch</a> (Linux) or <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/instancedata-add-user-data.html">Work with instance user data</a> (Windows) in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
45874585
*
45884586
* <p>If you are creating the launch template for use with Batch, the user
45894587
* data must be provided in the <a href="https://cloudinit.readthedocs.io/en/latest/topics/format.html#mime-multi-part-archive"> MIME multi-part archive format</a>. For more information, see <a href="https://docs.aws.amazon.com/batch/latest/userguide/launch-templates.html">Amazon EC2 user data in launch templates</a> in the <i>Batch User Guide</i>.</p>
@@ -4652,7 +4650,7 @@ export interface RequestLaunchTemplateData {
46524650

46534651
/**
46544652
* <p>Indicates whether an instance is enabled for hibernation. This parameter is valid only
4655-
* if the instance meets the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites">hibernation
4653+
* if the instance meets the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html">hibernation
46564654
* prerequisites</a>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your instance</a> in the
46574655
* <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
46584656
*/
@@ -4690,6 +4688,13 @@ export interface RequestLaunchTemplateData {
46904688
* <p>The maintenance options for the instance.</p>
46914689
*/
46924690
MaintenanceOptions?: LaunchTemplateInstanceMaintenanceOptionsRequest;
4691+
4692+
/**
4693+
* <p>Indicates whether to enable the instance for stop protection. For more information,
4694+
* see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection">Stop
4695+
* Protection</a>.</p>
4696+
*/
4697+
DisableApiStop?: boolean;
46934698
}
46944699

46954700
export namespace RequestLaunchTemplateData {
@@ -4713,7 +4718,7 @@ export interface CreateLaunchTemplateRequest {
47134718
/**
47144719
* <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the
47154720
* request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring
4716-
* Idempotency</a>.</p>
4721+
* idempotency</a>.</p>
47174722
* <p>Constraint: Maximum 128 ASCII characters.</p>
47184723
*/
47194724
ClientToken?: string;
@@ -4805,15 +4810,15 @@ export namespace LaunchTemplate {
48054810
export interface ValidationError {
48064811
/**
48074812
* <p>The error code that indicates why the parameter or parameter combination is not valid.
4808-
* For more information about error codes, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html">Error
4809-
* Codes</a>.</p>
4813+
* For more information about error codes, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html">Error
4814+
* codes</a>.</p>
48104815
*/
48114816
Code?: string;
48124817

48134818
/**
48144819
* <p>The error message that describes why the parameter or parameter combination is not
4815-
* valid. For more information about error messages, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html">Error
4816-
* Codes</a>.</p>
4820+
* valid. For more information about error messages, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html">Error
4821+
* codes</a>.</p>
48174822
*/
48184823
Message?: string;
48194824
}
@@ -4883,7 +4888,7 @@ export interface CreateLaunchTemplateVersionRequest {
48834888
/**
48844889
* <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the
48854890
* request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring
4886-
* Idempotency</a>.</p>
4891+
* idempotency</a>.</p>
48874892
* <p>Constraint: Maximum 128 ASCII characters.</p>
48884893
*/
48894894
ClientToken?: string;
@@ -5887,6 +5892,12 @@ export interface ResponseLaunchTemplateData {
58875892
* <p>The maintenance options for your instance.</p>
58885893
*/
58895894
MaintenanceOptions?: LaunchTemplateInstanceMaintenanceOptions;
5895+
5896+
/**
5897+
* <p>Indicates whether the instance is enabled for stop protection.
5898+
* For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection">Stop Protection</a>.</p>
5899+
*/
5900+
DisableApiStop?: boolean;
58905901
}
58915902

58925903
export namespace ResponseLaunchTemplateData {

clients/client-ec2/src/models/models_3.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5217,6 +5217,7 @@ export namespace DescribeImportSnapshotTasksResult {
52175217

52185218
export type InstanceAttributeName =
52195219
| "blockDeviceMapping"
5220+
| "disableApiStop"
52205221
| "disableApiTermination"
52215222
| "ebsOptimized"
52225223
| "enaSupport"
@@ -5453,6 +5454,12 @@ export interface InstanceAttribute {
54535454
* <p>The user data.</p>
54545455
*/
54555456
UserData?: AttributeValue;
5457+
5458+
/**
5459+
* <p>To enable the instance for Amazon Web Services Stop Protection, set this parameter to
5460+
* <code>true</code>; otherwise, set it to <code>false</code>.</p>
5461+
*/
5462+
DisableApiStop?: AttributeBooleanValue;
54565463
}
54575464

54585465
export namespace InstanceAttribute {

clients/client-ec2/src/models/models_5.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4823,6 +4823,13 @@ export interface ModifyInstanceAttributeRequest {
48234823
* <code>instanceInitiatedShutdownBehavior</code> attribute.</p>
48244824
*/
48254825
Value?: string;
4826+
4827+
/**
4828+
* <p>Indicates whether an instance is enabled for stop protection.
4829+
* For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection">Stop Protection</a>.</p>
4830+
* <p></p>
4831+
*/
4832+
DisableApiStop?: AttributeBooleanValue;
48264833
}
48274834

48284835
export namespace ModifyInstanceAttributeRequest {
@@ -5716,7 +5723,7 @@ export interface ModifyLaunchTemplateRequest {
57165723
/**
57175724
* <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the
57185725
* request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring
5719-
* Idempotency</a>.</p>
5726+
* idempotency</a>.</p>
57205727
* <p>Constraint: Maximum 128 ASCII characters.</p>
57215728
*/
57225729
ClientToken?: string;

clients/client-ec2/src/models/models_6.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,14 @@ export interface RunInstancesRequest {
19111911
* <p>The maintenance and recovery options for the instance.</p>
19121912
*/
19131913
MaintenanceOptions?: InstanceMaintenanceOptionsRequest;
1914+
1915+
/**
1916+
* <p>Indicates whether an instance is enabled for stop protection. For more information,
1917+
* see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection">Stop
1918+
* Protection</a>.
1919+
* </p>
1920+
*/
1921+
DisableApiStop?: boolean;
19141922
}
19151923

19161924
export namespace RunInstancesRequest {

clients/client-ec2/src/protocols/Aws_ec2.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47000,6 +47000,13 @@ const serializeAws_ec2ModifyInstanceAttributeRequest = (
4700047000
if (input.Value !== undefined && input.Value !== null) {
4700147001
entries["Value"] = input.Value;
4700247002
}
47003+
if (input.DisableApiStop !== undefined && input.DisableApiStop !== null) {
47004+
const memberEntries = serializeAws_ec2AttributeBooleanValue(input.DisableApiStop, context);
47005+
Object.entries(memberEntries).forEach(([key, value]) => {
47006+
const loc = `DisableApiStop.${key}`;
47007+
entries[loc] = value;
47008+
});
47009+
}
4700347010
return entries;
4700447011
};
4700547012

@@ -50340,6 +50347,9 @@ const serializeAws_ec2RequestLaunchTemplateData = (input: RequestLaunchTemplateD
5034050347
entries[loc] = value;
5034150348
});
5034250349
}
50350+
if (input.DisableApiStop !== undefined && input.DisableApiStop !== null) {
50351+
entries["DisableApiStop"] = input.DisableApiStop;
50352+
}
5034350353
return entries;
5034450354
};
5034550355

@@ -51299,6 +51309,9 @@ const serializeAws_ec2RunInstancesRequest = (input: RunInstancesRequest, context
5129951309
entries[loc] = value;
5130051310
});
5130151311
}
51312+
if (input.DisableApiStop !== undefined && input.DisableApiStop !== null) {
51313+
entries["DisableApiStop"] = input.DisableApiStop;
51314+
}
5130251315
return entries;
5130351316
};
5130451317

@@ -67140,6 +67153,7 @@ const deserializeAws_ec2InstanceAttribute = (output: any, context: __SerdeContex
6714067153
SourceDestCheck: undefined,
6714167154
SriovNetSupport: undefined,
6714267155
UserData: undefined,
67156+
DisableApiStop: undefined,
6714367157
};
6714467158
if (output.groupSet === "") {
6714567159
contents.Groups = [];
@@ -67210,6 +67224,9 @@ const deserializeAws_ec2InstanceAttribute = (output: any, context: __SerdeContex
6721067224
if (output["userData"] !== undefined) {
6721167225
contents.UserData = deserializeAws_ec2AttributeValue(output["userData"], context);
6721267226
}
67227+
if (output["disableApiStop"] !== undefined) {
67228+
contents.DisableApiStop = deserializeAws_ec2AttributeBooleanValue(output["disableApiStop"], context);
67229+
}
6721367230
return contents;
6721467231
};
6721567232

@@ -75337,6 +75354,7 @@ const deserializeAws_ec2ResponseLaunchTemplateData = (
7533775354
InstanceRequirements: undefined,
7533875355
PrivateDnsNameOptions: undefined,
7533975356
MaintenanceOptions: undefined,
75357+
DisableApiStop: undefined,
7534075358
};
7534175359
if (output["kernelId"] !== undefined) {
7534275360
contents.KernelId = __expectString(output["kernelId"]);
@@ -75504,6 +75522,9 @@ const deserializeAws_ec2ResponseLaunchTemplateData = (
7550475522
context
7550575523
);
7550675524
}
75525+
if (output["disableApiStop"] !== undefined) {
75526+
contents.DisableApiStop = __parseBoolean(output["disableApiStop"]);
75527+
}
7550775528
return contents;
7550875529
};
7550975530

0 commit comments

Comments
 (0)