-
Couldn't load subscription status.
- Fork 2.4k
feat: Allow Boto3 Session to be configured #1686
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jfuss Is this still relevant?
If so, can we move forward and merge it?
This would help with the associated issue.
We would then also have a clearer error message.
a69eb27 to
4d4ca1f
Compare
|
@mgrandis Yes this is still relevant, just slipped off my radar. I updated the PR but I remember there being some unit tests failures. I am going to see what travis reports and handle the issues that way. |
Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com>
Issue #, if available:
aws/aws-sam-cli#442
Description of changes:
This is the first part in solving aws/aws-sam-cli#442. Specifically, SAM uses boto to get a region and then pick the associated partition it lives within. This is mainly for two things (that I can tell):
For the first, we shouldn't need to explicitly put the partition into the template anywhere but instead use the CloudFormation pseudo value when writing the template. I attempted to do this initially but required changing every single output.json test file we have and the pr started to really grow. So I would like to handle that outside of this PR and get the bug addressed in SAM CLI first, and then come back and see how we can do somethings better.
For the second, we still need to find the partition and since there is no way to do this in the sdk, basing it on the region is the way to go.
This change adds an optional parameter into the transform call (effectively the 'public' api to translate the template). This optional parameter is currently only used to get the region but one could image this would be something SAM might be able to use in the future to be able to create any AWS Clients through Boto.
This will help solve the above issue because currently SAM creates a new session and has no way to know what profile or region was passed into SAM CLI. Because of this, locally customers see command failures with stacktraces from SAM for cases that should work. If approved, I will update SAM CLI to pass in a Boto Session which will end up resolving the issue linked above.
Description of how you validated changes:
Added unit tests and since this is an optional parameter, it is backwards compatible.
Checklist:
make prpassesExamples?
Please reach out in the comments, if you want to add an example. Examples will be
added to
sam initthrough https://github.com/awslabs/aws-sam-cli-app-templates/By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.