Improvements to AWS provider #962
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.
Improvements to ITransport.AmazonSQS
Improvements to SQS policy generation
Problem 1
In the production, we have faced limitation of SQS policy - size 8192 b
Proposed solution
In previous PR #808 I reduced policy size by combining statements for SNS access into one. Here I propose to replace all ARNs with wildcard if the prefixes for SNS and SQS name matches.
For example, there is SQS name
MyQueueand three related topics:If SNS name
MyQueuemathes with topic prefixes this may be compacted toIf the SNS name does not match (case with
SecondQueue), topics would not be compacted.Problem 2
Use of
_snsClient.SubscribeQueueToTopicsAsyncbroke compactization of SQS policies.Solution
After investigation of AWS SDK, it was found that
SubscribeQueueToTopicsAsyncinternally calls regeneration of SQS policy, but it would not recognize correctly wildcards, thus adds explicitly ARN of each SNS topic. Since the policy is already generated in the function above, usage ofSubscribeQueueToTopicsAsyncwas replaced withSubscribeAsync. This just ensures subscription to topic but does not regenerate policy.