fix awsRegion field in S3 notification #9370
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
It had been shown in the multi-account tests that we've had an issue where the
awsRegion
was not correct. It was using the client request region, when it should have been the bucket region.Also, per the documentation for
events
: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ev-events.html, theregion
field for the event should be the bucket region, which means theevents
client needs to be created with the bucket region and not the client region, as theregion
field in the event is from the internal client.Also validated the behaviour with AWS, that the region was of the bucket and not the client.
Changes
Fix the event payload for SQS/SNS/Lambda to use the region of the bucket for the
awsRegion
field.Fix the region for the
events
client used in the notifier.Add 2 tests to validate AWS behaviour (one created a bucket in another region than the default client for SQS, and one creating a client in a secondary region and the bucket in the default one).