This container has allows you to run the AWS PowerShell commands Linux or Mac.
PowerShell Version: 6.0.3 AWSPowerShell.NetCore: 3.3.313.0
~/.aws/usr/local/bin/ exists and is part of your PATHIn order to replace the PowerShell command with a container - you will create an alias and a small bash script to manage the state of the container in the background as detailed below:
echo "alias powershell='/usr/local/bin/powershell' >> ~/.bashrc"
cat >> /usr/local/bin/powershell << \EOF
#!/bin/bash
## First check if there is a container that exists
EXISTS=`docker ps -a | awk -F " " '{print $NF}'| grep -i powershell`
if [ $? -ne 0 ]
then
docker run -it -v ~/.aws/:/root/.aws --name powershell maishsk/awspowershell.netcore
else
## Check to see if the container is running in the background
IS_RUNNING=`docker ps -a | grep -i powershell | grep Up`
if [ $? -ne 0 ]
## Container is not running - start it
then
docker start -i powershell
## Container is running in another shell - take control
else
docker stop powershell
docker start -i powershell
fi
fi
EOF
chmod +x /usr/local/bin/powershell
You will have to source your .bashrc file for this alias to take effect.
Simply run powershell from your terminal
The container will mount your configuration as a persistent volume inside the container to /root/.aws/.
You will need to set the correct region that you want to work with
Set-DefaultAWSRegion -Region us-east-1
Or if you would like to already use the profiles in your config file you can run the following:
Set-DefaultAWSRegion -ProfileLocation /root/.aws/config
The wrapper used above allows for only one instance / session of the PowerShell container to exist at any time. This was my personal preference for my workflow - if you would like to work differently - then you will have to modify the bash script.
Please see this blog post for more information.
Content type
Image
Digest
Size
154.7 MB
Last updated
about 8 years ago
docker pull maishsk/awspowershell.netcore