AWS Security ChangesHomeSearch

AWS code-library documentation change

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

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

Summary

Added PowerShell V5 example for VM image import with security role requirements

Security assessment

Mentions required IAM roles and permissions for secure VM imports, but does not address a specific vulnerability. Highlights security best practices for image imports.

Diff

diff --git a/code-library/latest/ug/ec2_example_ec2_ImportImage_section.md b/code-library/latest/ug/ec2_example_ec2_ImportImage_section.md
index 32c4ad1f3..64a38c990 100644
--- a//code-library/latest/ug/ec2_example_ec2_ImportImage_section.md
+++ b//code-library/latest/ug/ec2_example_ec2_ImportImage_section.md
@@ -95,0 +96,42 @@ PowerShell
+**Tools for PowerShell V5**
+    
+
+**Example 1: This example imports a single-disk virtual machine image from the specified Amazon S3 bucket to Amazon EC2 with an idempotency token. The example requires that a VM Import Service Role with the default name 'vmimport' exists, with a policy allowing Amazon EC2 access to the specified bucket, as explained in the VM Import Prequisites topic. To use a custom role, specify the role name using the`-RoleName` parameter.**
+    
+    
+    $container = New-Object Amazon.EC2.Model.ImageDiskContainer
+    $container.Format="VMDK"
+    $container.UserBucket = New-Object Amazon.EC2.Model.UserBucket
+    $container.UserBucket.S3Bucket = "amzn-s3-demo-bucket"
+    $container.UserBucket.S3Key = "Win_2008_Server_Standard_SP2_64-bit-disk1.vmdk"
+    
+    $parms = @{
+        "ClientToken"="idempotencyToken"
+        "Description"="Windows 2008 Standard Image Import"
+        "Platform"="Windows"
+        "LicenseType"="AWS"
+    }
+    
+    Import-EC2Image -DiskContainer $container @parms
+    
+
+**Output:**
+    
+    
+    Architecture    : 
+    Description     : Windows 2008 Standard Image
+    Hypervisor      : 
+    ImageId         : 
+    ImportTaskId    : import-ami-abcdefgh
+    LicenseType     : AWS
+    Platform        : Windows
+    Progress        : 2
+    SnapshotDetails : {}
+    Status          : active
+    StatusMessage   : pending
+
+  * For API details, see [ImportImage](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. 
+
+
+
+