AWS Security ChangesHomeSearch

AWS code-library documentation change

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

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

Summary

Added detailed PowerShell V5 examples for GetSessionToken including MFA integration and credential management

Security assessment

Documents security best practices for temporary credential management including MFA protection and session duration controls. While security-related, there's no evidence this addresses a specific vulnerability.

Diff

diff --git a/code-library/latest/ug/sts_example_sts_GetSessionToken_section.md b/code-library/latest/ug/sts_example_sts_GetSessionToken_section.md
index d304a5bac..ec15ff4ec 100644
--- a//code-library/latest/ug/sts_example_sts_GetSessionToken_section.md
+++ b//code-library/latest/ug/sts_example_sts_GetSessionToken_section.md
@@ -103,0 +104,47 @@ PowerShell
+**Tools for PowerShell V5**
+    
+
+**Example 1: Returns an`Amazon.RuntimeAWSCredentials` instance containing temporary credentials valid for a set period of time. The credentials used to request temporary credentials are inferred from the current shell defaults. To specify other credentials, use the -ProfileName or -AccessKey/-SecretKey parameters.**
+    
+    
+    Get-STSSessionToken
+    
+
+**Output:**
+    
+    
+    AccessKeyId                             Expiration                              SecretAccessKey                        SessionToken
+    -----------                             ----------                              ---------------                        ------------
+    EXAMPLEACCESSKEYID                      2/16/2015 9:12:28 PM                    examplesecretaccesskey...              SamPleTokeN.....
+
+**Example 2: Returns an`Amazon.RuntimeAWSCredentials` instance containing temporary credentials valid for one hour. The credentials used to make the request are obtained from the specified profile.**
+    
+    
+    Get-STSSessionToken -DurationInSeconds 3600 -ProfileName myprofile
+    
+
+**Output:**
+    
+    
+    AccessKeyId                             Expiration                              SecretAccessKey                        SessionToken
+    -----------                             ----------                              ---------------                        ------------
+    EXAMPLEACCESSKEYID                      2/16/2015 9:12:28 PM                    examplesecretaccesskey...              SamPleTokeN.....
+
+**Example 3: Returns an`Amazon.RuntimeAWSCredentials` instance containing temporary credentials valid for one hour using the identification number of the MFA device associated with the account whose credentials are specified in the profile 'myprofilename' and the value provided by the device.**
+    
+    
+    Get-STSSessionToken -DurationInSeconds 3600 -ProfileName myprofile -SerialNumber YourMFADeviceSerialNumber -TokenCode 123456
+    
+
+**Output:**
+    
+    
+    AccessKeyId                             Expiration                              SecretAccessKey                        SessionToken
+    -----------                             ----------                              ---------------                        ------------
+    EXAMPLEACCESSKEYID                      2/16/2015 9:12:28 PM                    examplesecretaccesskey...              SamPleTokeN.....
+
+  * For API details, see [GetSessionToken](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. 
+
+
+
+