AWS Security ChangesHomeSearch

AWS AWSEC2 documentation change

Service: AWSEC2 · 2025-05-03 · Documentation low

File: AWSEC2/latest/UserGuide/concepts-spot-instances-request-tags.md

Summary

Updated tagging documentation with expanded CLI/PowerShell examples, fixed IAM policy syntax, and added PowerShell equivalents for tagging operations

Security assessment

While IAM policies and resource tagging relate to security best practices, these changes only improve documentation clarity and completeness. No specific security vulnerabilities are addressed, and the IAM policy fix appears to be a syntax correction rather than a security patch.

Diff

diff --git a/AWSEC2/latest/UserGuide/concepts-spot-instances-request-tags.md b/AWSEC2/latest/UserGuide/concepts-spot-instances-request-tags.md
index e8c174ec5..55c911522 100644
--- a//AWSEC2/latest/UserGuide/concepts-spot-instances-request-tags.md
+++ b//AWSEC2/latest/UserGuide/concepts-spot-instances-request-tags.md
@@ -137,0 +138,2 @@ Create a IAM policy that includes the following:
+        ]
+    }
@@ -140,0 +143,9 @@ Create a IAM policy that includes the following:
+In the AWS CLI and PowerShell examples, configure the Spot Instance request as follows:
+
+  * For `ResourceType`, specify `spot-instances-request`. If you specify another value, the Spot Instance request will fail.
+
+  * For `Tags`, specify the key-value pair. You can specify more than one key-value pair.
+
+
+
+
@@ -160 +171 @@ AWS CLI
-###### To tag a new Spot Instance request using the AWS CLI
+###### To tag a new Spot Instance request
@@ -162 +173 @@ AWS CLI
-To tag a Spot Instance request when you create it, configure the Spot Instance request configuration as follows:
+Use the [request-spot-instances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/request-spot-instances.html) command with the `--tag-specification` option.
@@ -164 +175 @@ To tag a Spot Instance request when you create it, configure the Spot Instance r
-  * Specify the tags for the Spot Instance request using the `--tag-specification` parameter.
+The tag specification adds two tags to the Spot Instance request: `Environment=Production` and `Cost-Center=123`.
@@ -166 +176,0 @@ To tag a Spot Instance request when you create it, configure the Spot Instance r
-  * For `ResourceType`, specify `spot-instances-request`. If you specify another value, the Spot Instance request will fail.
@@ -168 +178,5 @@ To tag a Spot Instance request when you create it, configure the Spot Instance r
-  * For `Tags`, specify the key-value pair. You can specify more than one key-value pair.
+    aws ec2 request-spot-instances \
+        --instance-count 5 \
+        --type "one-time" \
+        --launch-specification file://specification.json \
+        --tag-specification 'ResourceType=spot-instances-request,Tags=[{Key=Environment,Value=Production},{Key=Cost-Center,Value=123}]'
@@ -169,0 +184 @@ To tag a Spot Instance request when you create it, configure the Spot Instance r
+PowerShell
@@ -171,0 +187 @@ To tag a Spot Instance request when you create it, configure the Spot Instance r
+###### To tag a new Spot Instance request
@@ -173 +189 @@ To tag a Spot Instance request when you create it, configure the Spot Instance r
-In the following example, the Spot Instance request is tagged with two tags: Key=Environment and Value=Production, and Key=Cost-Center and Value=123.
+Use the [Request-EC2SpotInstance](https://docs.aws.amazon.com/powershell/latest/reference/items/Request-EC2SpotInstance.html) cmdlet with the `-TagSpecification` parameter.
@@ -176,5 +192,10 @@ In the following example, the Spot Instance request is tagged with two tags: Key
-    aws ec2 request-spot-instances \
-        --instance-count 5 \
-        --type "one-time" \
-        --launch-specification file://specification.json \
-        --tag-specification 'ResourceType=spot-instances-request,Tags=[{Key=Environment,Value=Production},{Key=Cost-Center,Value=123}]'
+    -TagSpecification $tagspec
+
+The tag specification is defined as follows. It adds two tags to the Spot Instance request: `Environment=Production` and `Cost-Center=123`.
+    
+    
+    $tag1 = @{Key="Environment"; Value="Production"}
+    $tag2 = @{Key="Cost-Center"; Value="123"}
+    $tagspec = New-Object Amazon.EC2.Model.TagSpecification
+    $tagspec.ResourceType = "spot-instances-request"
+    $tagspec.Tags = @($tag1,$tag2)
@@ -209 +230 @@ AWS CLI
-###### To tag an existing Spot Instance request or Spot Instance using the AWS CLI
+###### To tag an existing Spot Instance request or Spot Instance
@@ -211 +232 @@ AWS CLI
-Use the [create-tags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/create-tags.html) command to tag existing resources. In the following example, the existing Spot Instance request and the Spot Instance are tagged with Key=purpose and Value=test. 
+Use the [create-tags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/create-tags.html) command to tag existing resources. In the following example, the existing Spot Instance request and the Spot Instance are tagged with `purpose=test`.
@@ -217,0 +239,12 @@ Use the [create-tags](https://awscli.amazonaws.com/v2/documentation/api/latest/r
+PowerShell
+    
+
+###### To tag an existing Spot Instance request or Spot Instance
+
+Use the [New-EC2Tag](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Tag.html) cmdlet. The following example adds the tag `purpose=test` to the existing Spot Instance request and the Spot Instance.
+    
+    
+    New-EC2Tag `
+        -Resource sir-0e54a519c9EXAMPLE, i-1234567890abcdef0 `
+        -Tag @{Key="purpose"; Value="test"}
+
@@ -239 +272 @@ AWS CLI
-You can view the tags of a Spot Instance request by describing the Spot Instance request. Use the [describe-spot-instance-requests](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-spot-instance-requests.html) command to view the configuration of the specified Spot Instance request, which includes any tags that were specified for the request.
+Use the [describe-spot-instance-requests](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-spot-instance-requests.html) command to view the configuration of the specified Spot Instance request, which includes any tags that were specified for the request.
@@ -261,0 +295,19 @@ The following is example output.
+PowerShell
+    
+
+###### To describe Spot Instance request tags
+
+Use the [Get-EC2SpotInstanceRequest](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2SpotInstanceRequest.html) cmdlet.
+    
+    
+    (Get-EC2SpotInstanceRequest `
+        -SpotInstanceRequestId sir-0e54a519c9EXAMPLE).Tags
+
+The following is example output.
+    
+    
+    Key         Value
+    ---         -----
+    Environment Production
+    Department  101
+