TylerBrock / saw

Fast, multi-purpose tool for AWS CloudWatch Logs
MIT License
1.41k stars 79 forks source link

Region support #1

Closed trondhindenes closed 6 years ago

trondhindenes commented 6 years ago

Awesome tool! It looks like there's no region support, is that correct?

TylerBrock commented 6 years ago

Thanks for the kind words!

Right now saw reads the region from your profile, usually whatever is in ~/.aws/config. This is a what mine looks like:

[profile default]
output = json
region = us-east-1
[profile west]
output = json
region = us-west-1

I know this isn't an ideal solution but the AWS Golang library lets you set a region using environment variables:

export AWS_REGION=us-west-1

Or, if you have another profile that is in a different region

export AWS_PROFILE=my-profile-in-other-region

This is great feedback though as I should add both a flag for region and one that lets you specify another profile. I'll work on that next!

hwatts commented 6 years ago

I think the region is hard coded to us-east-1 unless I'm doing something wrong. Looks like a great tool, look forward to using it!

spezam commented 6 years ago

blade/blade.go 26 region := endpoints.UsEast1RegionID 27 awsConfig := aws.Config{Region: &region}

seems the region is hardcoded to us-east-1

TylerBrock commented 6 years ago

Yep, so it is. Sorry for not looking deeper yesterday. Let me fix that up and cut a new release.

trondhindenes commented 6 years ago

awesome!

TylerBrock commented 6 years ago

So sorry for the delay, my wife and I just had a baby girl Friday night so we've been exhausted and busy!

hwatts commented 6 years ago

Firstly, congratulations! Secondly, don’t sweat it, you’ve provided this for free and it looks awesome, you don’t owe us anything!

spezam commented 6 years ago

Congrats Tyler :)

TylerBrock commented 6 years ago

Took a little break, haha! 😄I was able to have it read from the default profile pretty easily.

I still need to add overrides for region + profile so you can more easily select them via -r and -p but the v0.1.4 release should work if you have ~/.aws/config profile default to the region you want. Let me know if that works for you all right now in a pinch.

spezam commented 6 years ago

Tested it with ~/.aws/credentials set to [profilename] aws_access_key_id = 123 aws_secret_access_key = 123 region = eu-west-1

and it works perfectly. Thanks again for the quick fix!

TylerBrock commented 6 years ago

Support for overriding default profile and the current profile's region will be released as part of v0.1.5 in a couple minutes... hold tight 🚢 :shipit: