We all know that the GUI/Console for AWS is sadly slow and cumbersome to use. That’s why they created the CLI and SDK tools to let impatient people do more work in less time. However, the CLI and SDK are also slow because well, processing time takes for ever sometimes. So for the truly impatient isn’t it nice that you can use GNU Parallel to complete more work in less time? Let me show you an example.
[Read More]AWS IAM Scan for Role Name
Scan AWS Account for IAM Role
If you are like me you happen to work with ALZs with LOTS of accounts. Jumping into each one to verify a role exists, or doesn’t it quite tedious. So here I have a simple “one-liner” that loops through your accounts and looks for the existence of a role (by partial lookup).
One-liner
for role in $(cat ~/.aws/credentials | grep devopsadmin | cut -d '[' -f2 | cut -d ']' -f1 | grep -v ^role_arn); do echo $role; aws --profile $role iam list-roles | jq -r ".Roles[].RoleName" | grep CMK; done
Breakdown
First we tell bash to list grab our AWS Credentials file, which is an INI that we store the profile names in as
[ProfileName], in my case I only care for the names containing devopsadmin. The cut is to trim the [ & ] off
the line, and finally the grep -v skips any lines that start with role_arn as these aren’t needed (this time).
AWS Backup Delete Script
Delete AWS Backup artifacts
AWS Backup is a great utility, but when you are cleaning up an account it takes a long time to remove all the backup artifacts by hand in the console. So instead I present this one-liner
Single Region
$ aws --region us-east-1 backup list-recovery-points-by-backup-vault --backup-vault-name default | jq '.RecoveryPoints' | jq -c -r '.[].RecoveryPointArn' | xargs --max-lines=1 aws --region us-east-1 backup delete-recovery-point --backup-vault-name default --recovery-point-arn
Multiple Regions
$ regions=us-east-1,us-west-2; for region in $regions; do aws --region ${region} backup list-recovery-points-by-backup-vault --backup-vault-name default | jq '.RecoveryPoints' | jq -c -r '.[].RecoveryPointArn' | xargs --max-lines=1 aws --region ${region} backup delete-recovery-point --backup-vault-name default --recovery-point-arn; done
Nginx + SSL/TLS through Let's Encrypt
Let’s Encrypt + Nginx is simple easy!
Look, it’s 2020, and if your site isn’t provided under SSL/TLS then you are behind even the least sophisticated scammers out there.
Here is a quick walk through on using certbot from
Let’s Encrypt, that provides easy to acquire, and
even renew your certificates if you’re using Nginx.
NOTE: These directions are geared toward Fedora users, but this is literally just as easy on Ubuntu, Arch, Gentoo, etc.
[Read More]Certifications Updated
Updated the dev blog with my certifications.
Utahcon.dev 2020 is a go!
Man 2020 has been a rocky start to say the least! However, I am finally getting some time to do the things around my lab that just need to be done. This little project is one of those things.
What is this project?
For years I have wanted to separate out the aspects of my life, to compartmentalize. I have lots of personal things I want to accomplish, but I don’t want to muddy a personal site with professional journals and tech jargon. So I am declaring utahcon.dev the Development Blog, more or less.
[Read More]