This post contains some useful AWS commands and scripts.
AWS Commands
Command |
---|
aws sts get-caller-identity |
Filtering command output
--query PROP_PATH
. Like you're usingjq
for querying JSON string. You can save the initial.
--output text|json
. Output as text print values without quotes.
Most used commands
aws sts get-caller-identity --query Arn --output text
get current user ARN
Script to verify credentials
current_credentials=$(aws sts get-caller-identity --query Arn --output text)
expected_credentials="arn:aws:iam::{ACCOUNT_ID}}:user/{USER_NAME}"
if [[ "${current_credentials}" != "${expected_credentials}" ]]; then
echo "\033[31m INVALID CREDENTIALS \033[0m" # PRINT THIS IN RED
return
fi
About me
I'm a Software Engineer with experience as Developer and DevOps. The technologies I have worked with are DotNet, Terraform and AWS. For the last one, I have the Developer Associate certification. I define myself as a challenge-seeker person and team player. I simply give it all to deliver high-quality solutions. On the other hand, I like to analyze and improve processes, promote productivity and document implementations (yes, I'm a developer that likes to document ๐งโ๐ป).
You can check my experience here.
Personal Blog - cangulo.github.io
GitHub - Carlos Angulo Mascarell - cangulo
LinkedIn - Carlos Angulo Mascarell
Twitter - @AnguloMascarell