AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-06-28 · Documentation low

File: code-library/latest/ug/ec2_example_ec2_RequestSpotInstances_section.md

Summary

Added PowerShell V5 example for requesting Spot instances with network interface configuration

Security assessment

The change adds a usage example demonstrating proper security group configuration but does not address any specific security vulnerability or weakness

Diff

diff --git a/code-library/latest/ug/ec2_example_ec2_RequestSpotInstances_section.md b/code-library/latest/ug/ec2_example_ec2_RequestSpotInstances_section.md
index 0108786bf..b6c14d346 100644
--- a//code-library/latest/ug/ec2_example_ec2_RequestSpotInstances_section.md
+++ b//code-library/latest/ug/ec2_example_ec2_RequestSpotInstances_section.md
@@ -225,0 +226,42 @@ PowerShell
+**Tools for PowerShell V5**
+    
+
+**Example 1: This example requests a one-time Spot instance in the specified subnet. Note that the security group must be created for the VPC that contains the specified subnet, and it must be specified by ID using the network interface. When you specify a network interface, you must include the subnet ID using the network interface.**
+    
+    
+    $n = New-Object Amazon.EC2.Model.InstanceNetworkInterfaceSpecification
+    $n.DeviceIndex = 0
+    $n.SubnetId = "subnet-12345678"
+    $n.Groups.Add("sg-12345678")
+    Request-EC2SpotInstance -InstanceCount 1 -SpotPrice 0.050 -Type one-time `
+    -IamInstanceProfile_Arn arn:aws:iam::123456789012:instance-profile/my-iam-role `
+    -LaunchSpecification_ImageId ami-12345678 `
+    -LaunchSpecification_InstanceType m3.medium `
+    -LaunchSpecification_NetworkInterface $n
+    
+
+**Output:**
+    
+    
+    ActualBlockHourlyPrice   :
+    AvailabilityZoneGroup    :
+    BlockDurationMinutes     : 0
+    CreateTime               : 12/26/2015 7:44:10 AM
+    Fault                    :
+    InstanceId               :
+    LaunchedAvailabilityZone :
+    LaunchGroup              :
+    LaunchSpecification      : Amazon.EC2.Model.LaunchSpecification
+    ProductDescription       : Linux/UNIX
+    SpotInstanceRequestId    : sir-12345678
+    SpotPrice                : 0.050000
+    State                    : open
+    Status                   : Amazon.EC2.Model.SpotInstanceStatus
+    Tags                     : {}
+    Type                     : one-time
+
+  * For API details, see [RequestSpotInstances](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. 
+
+
+
+