List services concurrently in GO
This program list and write in json format a file.log RDS and Elasticache services available for specific region and IAM role, using go routines.
A go routine is a function that is capable of running concurrently with
other functions.
run with Build
execute go build main.go
then region=us-east-1 role=prod ./main
- region can be any aws region options such as:
sa-east-1
, us-east-1
and so on.
- role must be
prod
, stage
or old
What you will need 🔨
Assuming that you already have your AWS credentials in /.aws file.
create a .env file and set the role arn as env vars,to switch roles properly:
role_prod=arn:aws:iam::123456:role/ProdblablaViewOnllyFULL-sadlp43
role_stage=arn:aws:iam::14324324:role/StageblablaViewOnlyFULL-34234
role_old=arn:aws:iam::21231:role/OldblablaFullAccess-214324
role_auth=arn:aws:iam::109267741677:role/AuthblablaFullViewacase24
Output Interface 📜
[count] x Instances:
{
"Name": "instanceName",
"Endpoint": {
"Address": "address",
"Port": 5432
},
"Engine": "postgres:11.5"
}, ...
- Above is what expected in output terminal and instances.log file for each service listed.
- May not print in the same order cause go routine can terminate in diferent times.