profile for Gajendra D Ambi on Stack Exchange, a network of free, community-driven Q&A sites

Saturday, December 16, 2017

getting started with amazon AWS with Powershell

You first need windows and I got it from here
https://aws.amazon.com/powershell/
Now I do not want to show you my credentials to log in to my aws so that you can spin up your own workload on my credit card so I downloaded the csv file containing the access key ID and secret key.

1
2
3
4
5
$credCsv = 'C:\Users\<username>\Foldename\aws_accessKeys.csv'
$csv = Import-Csv $credCsv
$keyId = $csv.'Access key ID'
$skey = $csv.'Secret access key'
Set-AWSCredential -AccessKey $keyId -SecretKey $skey -StoreAs batman

1. path to the credentials
2. import the csv file contents
3. extracting the access key ID and storing it as a variable to use later
4. extracting the secret access key from the csv
5. loging in to my AWS and storing it as a profile


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
PS C:\Users\gaju> $credCsv = 'C:\Users\<username>\Foldername\aws_accessKeys.csv'
$csv = Import-Csv $credCsv
$keyId = $csv.'Access key ID'
$skey = $csv.'Secret access key'
Set-AWSCredential -AccessKey $keyId -SecretKey $skey -StoreAs batman
Get-AWSRegion

Region         Name                      IsShellDefault
------         ----                      --------------
ap-northeast-1 Asia Pacific (Tokyo)      False         
ap-northeast-2 Asia Pacific (Seoul)      False         
ap-south-1     Asia Pacific (Mumbai)     False         
ap-southeast-1 Asia Pacific (Singapore)  False         
ap-southeast-2 Asia Pacific (Sydney)     False         
ca-central-1   Canada (Central)          False         
eu-central-1   EU Central (Frankfurt)    False         
eu-west-1      EU West (Ireland)         False         
eu-west-2      EU West (London)          False         
sa-east-1      South America (Sao Paulo) False         
us-east-1      US East (Virginia)        False         
us-east-2      US East (Ohio)            False         
us-west-1      US West (N. California)   False         
us-west-2      US West (Oregon)          False   

Now you see that when you run Get-AWSRegion I get a list of all the available regions.This is the time you want to play with it. Whenever you start automating or scripting stuff, you should and must always start only with getting information. Generating reports etc., which will safely allow you to get a hang on the eco system. You do not want to accidentally do something which you will regret for life.

No comments:

Post a Comment