Skip to content

Commit 4a71f07

Browse files
Added support for the force option for the EC2 instance terminate command. This feature enables customers to recover resources associated with an instance stuck in the shutting-down state as a result of rare issues caused by a frozen operating system or an underlying hardware problem.
1 parent ac2bbcb commit 4a71f07

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed

generator/ServiceModels/ec2/ec2-2016-11-15.api.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48304,6 +48304,7 @@
4830448304
"shape":"InstanceIdStringList",
4830548305
"locationName":"InstanceId"
4830648306
},
48307+
"Force":{"shape":"Boolean"},
4830748308
"SkipOsShutdown":{"shape":"Boolean"},
4830848309
"DryRun":{
4830948310
"shape":"Boolean",

generator/ServiceModels/ec2/ec2-2016-11-15.docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3201,6 +3201,7 @@
32013201
"Subnet$DefaultForAz": "<p>Indicates whether this is the default subnet for the Availability Zone.</p>",
32023202
"Subnet$MapPublicIpOnLaunch": "<p>Indicates whether instances launched in this subnet receive a public IPv4 address.</p> <p>Amazon Web Services charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the <i>Public IPv4 Address</i> tab on the <a href=\"http://aws.amazon.com/vpc/pricing/\">Amazon VPC pricing page</a>.</p>",
32033203
"TerminateClientVpnConnectionsRequest$DryRun": "<p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>",
3204+
"TerminateInstancesRequest$Force": "<p>Forces the instances to terminate. The instance will first attempt a graceful shutdown, which includes flushing file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the instance shuts down forcibly without flushing the file system caches and metadata.</p>",
32043205
"TerminateInstancesRequest$SkipOsShutdown": "<p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p> <p>Default: <code>false</code> </p>",
32053206
"TerminateInstancesRequest$DryRun": "<p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>",
32063207
"TransitGatewayMulticastGroup$GroupMember": "<p>Indicates that the resource is a transit gateway multicast group member.</p>",

generator/ServiceModels/ec2/ec2-2016-11-15.normal.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62819,6 +62819,10 @@
6281962819
"documentation":"<p>The IDs of the instances.</p> <p>Constraints: Up to 1000 instance IDs. We recommend breaking up this request into smaller batches.</p>",
6282062820
"locationName":"InstanceId"
6282162821
},
62822+
"Force":{
62823+
"shape":"Boolean",
62824+
"documentation":"<p>Forces the instances to terminate. The instance will first attempt a graceful shutdown, which includes flushing file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the instance shuts down forcibly without flushing the file system caches and metadata.</p>"
62825+
},
6282262826
"SkipOsShutdown":{
6282362827
"shape":"Boolean",
6282462828
"documentation":"<p>Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.</p> <p>Default: <code>false</code> </p>"

sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/TerminateInstancesRequestMarshaller.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ public IRequest Marshall(TerminateInstancesRequest publicRequest)
5959

6060
if(publicRequest != null)
6161
{
62+
if(publicRequest.IsSetForce())
63+
{
64+
request.Parameters.Add("Force", StringUtils.FromBool(publicRequest.Force));
65+
}
6266
if(publicRequest.IsSetInstanceIds())
6367
{
6468
int publicRequestlistValueIndex = 1;

sdk/src/Services/EC2/Generated/Model/TerminateInstancesRequest.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ namespace Amazon.EC2.Model
128128
/// </summary>
129129
public partial class TerminateInstancesRequest : AmazonEC2Request
130130
{
131+
private bool? _force;
131132
private List<string> _instanceIds = AWSConfigs.InitializeCollections ? new List<string>() : null;
132133
private bool? _skipOsShutdown;
133134

@@ -145,6 +146,27 @@ public TerminateInstancesRequest(List<string> instanceIds)
145146
_instanceIds = instanceIds;
146147
}
147148

149+
/// <summary>
150+
/// Gets and sets the property Force.
151+
/// <para>
152+
/// Forces the instances to terminate. The instance will first attempt a graceful shutdown,
153+
/// which includes flushing file system caches and metadata. If the graceful shutdown
154+
/// fails to complete within the timeout period, the instance shuts down forcibly without
155+
/// flushing the file system caches and metadata.
156+
/// </para>
157+
/// </summary>
158+
public bool Force
159+
{
160+
get { return this._force.GetValueOrDefault(); }
161+
set { this._force = value; }
162+
}
163+
164+
// Check to see if Force property is set
165+
internal bool IsSetForce()
166+
{
167+
return this._force.HasValue;
168+
}
169+
148170
/// <summary>
149171
/// Gets and sets the property InstanceIds.
150172
/// <para>

0 commit comments

Comments
 (0)