AWS Tools for PowerShell. The AWS Tools for PowerShell let developers and administrators manage their AWS services and resources in the PowerShell scripting environment. Now you can manage your AWS resources with the same PowerShell tools you use to manage your Windows, Linux, and MacOS environments.
Install
Install-Module -Name AWS.Tools.Common
Credentials
Credentials are stored at
- On Linux/Mac: ~/.aws/credentials
- On Windows: C:\Users\username.aws\credentials
Create New Profile
Set-AWSCredential `
-AccessKey AAAAAAAAAAAAAAAAAAAAAAAAAAA `
-SecretKey ZZZZZZZZZZZZZZZZZZZZZZZZZZZZz `
-StoreAs MyNewProfile
Update Profile
Set-AWSCredential `
-AccessKey BBBBBBBBBBBBBBBBBBBBBBBBBB `
-SecretKey YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY `
-StoreAs MyNewProfile
Remove Profile
Remove-AWSCredentialProfile -ProfileName MyOldProfile
Session Profile
Use Set-AWSCredential to specify a default profile for a particular session. This profile overrides any default profile for the duration of the session. We recommend this if you want to use a custom-named profile in your session instead of the current default profile.
Set-AWSCredential -ProfileName MyProfileName
Import EC2 Key Pair
$publickey=[Io.File]::ReadAllText("C:\Users\TestUser\.ssh\id_rsa.pub")
$pkbase64 = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($publickey))
Import-EC2KeyPair -KeyName Example-user-key -PublicKey $pkbase64
Related
- Powershell Split Text into Individual Lines
- PowerShell Accepting Pipeline Input
- Install PowerShell Core on Raspberry Pi OS
- Moving AD Computer Object with Powershell
- Rounding Numbers in PowerShell
- Install AWS CLI
Links
- https://docs.aws.amazon.com/powershell/index.html