Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a new env variable for crossing-region scenario (app migration) #22

Merged
merged 3 commits into from
Mar 10, 2023

Conversation

ymao2
Copy link
Contributor

@ymao2 ymao2 commented Feb 17, 2023

This PR is to address athena connection issue, for one of dashboard apps ( gold-scorecard-form (https://github.com/moj-analytical-services/gold-scorecard-form)

The platform we are going to use for all the AP dashboard apps is Cloud-platform (central moj infrastructure), their AWS resources are managed under different account and region they use is eu-west-2, but our athena service and all the datasets (buckets) we manage are under admin-data account with region eu-west-1, so there are involved some cross-accounts and cross-region issue.

Last week we managed to get the cross-account permission work, then found out the region on AWS_DEFAULT_REGION and AWS_REGION are linked to the underline cluster, we cannot overwrite it

This PR is to introduce an new alternative env var for Rdbtools to retrieve the default region of s3 buckets ( AWS_ATHENA_QUERY_REGION), it will give benefit of requiring only minor changes to other apps using this R pacakge

@mratford @pjrh-moj , what do you think? keen to hear your feedback, as we want to get the app change done asap

Copy link

@julialawrence julialawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ymao2 ymao2 requested review from mratford and pjrh-moj February 20, 2023 11:05
@pjrh-moj
Copy link
Contributor

The alternative is just to set the aws_region argument of connect_athena() - is there some reason you can't just do that?

Otherwise, I think that's fine. Can you put a note explaining this into the comment above get_region() and also the @param aws_region docstring for connect_athena()?

Thanks!

@ymao2
Copy link
Contributor Author

ymao2 commented Feb 21, 2023

The alternative is just to set the aws_region argument of connect_athena() - is there some reason you can't just do that?

Otherwise, I think that's fine. Can you put a note explaining this into the comment above get_region() and also the @param aws_region docstring for connect_athena()?

Thanks!

Thank you very much for reviewing PR 👍 .

Yes, I knew the region can be passed from the scripts/codes using this package, the only reason for raising this PR is that it require quite minor changes from app code side and hide such detail from them 😳 , no other strong reason. Introducing a new env var does make the package itself less universal, but since the PR had some code already specific to DP , m codes hopefully doesn't make it worse 😳

I will update the param and doc

@pjrh-moj
Copy link
Contributor

I'm all for hiding details from users! Thanks for finding this issue and providing a fix!

@ymao2 ymao2 changed the title Testing athena bucket region for app migration Added a new env variable for crossing-region scenario (app migration) Mar 8, 2023
@ymao2
Copy link
Contributor Author

ymao2 commented Mar 8, 2023

I added some notes in the readme and the function itself, have a look to see whether they make sense or not, thank you!

@ymao2
Copy link
Contributor Author

ymao2 commented Mar 10, 2023

@pjrh-moj and @mratford, I am going to merge this PR, would it be possible to make a new release after that ? we are trying to update one of dashboard apps for app migration, and we are blocking by this small change, once the new release is made, then I can update this app to use new version

thank you! 😳

@ymao2 ymao2 merged commit 0d1d692 into main Mar 10, 2023
@pjrh-moj
Copy link
Contributor

released as v0.3.0 - hope the migration goes smoothly!

@pjrh-moj pjrh-moj deleted the app-migration-athena-region-testing branch March 10, 2023 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants