40 lines
801 B
PowerShell
40 lines
801 B
PowerShell
|
function New-AWSCredentialsFile {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Used to setup a new AWS Config File
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
[OutputType([void])]
|
||
|
param (
|
||
|
[Parameter(Mandatory = $true)]
|
||
|
$FilePath
|
||
|
)
|
||
|
|
||
|
$logLead = (Get-LogLeadName)
|
||
|
|
||
|
if (Test-Path $FilePath) {
|
||
|
throw "$logLead : Can not replace existing AWS Credentials file at [$FilePath]. Please remove the file and try again."
|
||
|
}
|
||
|
|
||
|
$fileContents = @"
|
||
|
[default]
|
||
|
aws_access_key_id =
|
||
|
aws_secret_access_key =
|
||
|
output=json
|
||
|
region=us-east-1
|
||
|
[temp-dev]
|
||
|
aws_access_key_id=
|
||
|
aws_secret_access_key=
|
||
|
aws_session_token=
|
||
|
[temp-prod]
|
||
|
aws_access_key_id=
|
||
|
aws_secret_access_key=
|
||
|
aws_session_token=
|
||
|
[temp-qa]
|
||
|
aws_access_key_id=
|
||
|
aws_secret_access_key=
|
||
|
aws_session_token=
|
||
|
"@
|
||
|
|
||
|
Set-Content -Path $FilePath -Value $fileContents -Force
|
||
|
}
|