Page MenuHomePhabricator

[services] Tunnelbroker - Change in `getAwsRegion()` function to use `.aws/credentials`
ClosedPublic

Authored by max on Jul 13 2022, 3:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jan 5, 1:27 PM
Unknown Object (File)
Thu, Jan 2, 10:29 PM
Unknown Object (File)
Wed, Dec 25, 9:54 AM
Unknown Object (File)
Wed, Dec 25, 9:54 AM
Unknown Object (File)
Wed, Dec 25, 9:54 AM
Unknown Object (File)
Wed, Dec 25, 9:51 AM
Unknown Object (File)
Mon, Dec 16, 11:56 PM
Unknown Object (File)
Mon, Dec 16, 11:56 PM

Details

Summary

This diff introduces changes to the getAWSRegion() function to parse ~/.aws/credentials for a region parameter to omit using second config ~/.aws/config. The function uses a same approach as a ConfigManager.

The full context is available in ENG-742 task.

Test Plan

The function returns the region parameter if it's available in the ~/.aws/credentials in the following format:

[default]
...
region = some_region

Or returns an empty string.

Diff Detail

Repository
rCOMM Comm
Branch
change-aws-region-function
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

max held this revision as a draft.
max published this revision for review.Jul 13 2022, 3:33 AM
max edited the summary of this revision. (Show Details)
max edited the test plan for this revision. (Show Details)
max added reviewers: tomek, karol.
tomek added a subscriber: varun.

I'm not sure how to review this - resigning for now and adding @varun to give the first review

In D4513#129920, @palys-swm wrote:

I'm not sure how to review this - resigning for now and adding @varun to give the first review

Thanks, this issue was raised by @karol-bisztyga so he definitely needs to be as blocking here.

is this really a best practice? the region section of this doc says to use ~/.aws/config (what we're currently doing, it seems)

This revision is now accepted and ready to land.Jul 19 2022, 11:11 AM
In D4513#130650, @varun wrote:

is this really a best practice? the region section of this doc says to use ~/.aws/config (what we're currently doing, it seems)

Oh, it's a long story with the context in ENG-742. The reason we doing this is when we are running inside the AWS EC2 we don't need to provide the region. This parameter is only used for local development or outside of the AWS. That's why we had a long discussion with @karol and @tomek and decided not to create a second config file for the local development and use the only one.