-
Notifications
You must be signed in to change notification settings - Fork 1
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
[ETL-535] Set up SQS to receive S3 event notification #75
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3d22448
add initial sqs queue setup
6c29f29
change to str
f5c5f81
add changes to event config lambda to support sending to SQS queues
db1b247
add missing aws service param and change destination arn to sqs queue
ff4fbc8
add allowed values, add prod ver of sqs queue and event conifg lambda
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
template: | ||
path: sqs-queue.yaml | ||
parameters: | ||
MessageRetentionPeriod: '86400' | ||
ReceiveMessageWaitTimeSeconds: '20' | ||
VisibilityTimeout: '120' | ||
S3SourceBucketArn: !stack_output_external recover-dev-input-bucket::BucketArn | ||
dependencies: | ||
- develop/namespaced/s3-to-glue-lambda.yaml | ||
- develop/s3-input-bucket.yaml | ||
stack_name: '{{ stack_group_config.namespace }}-sqs-S3ToLambda' | ||
stack_tags: | ||
{{ stack_group_config.default_stack_tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,13 @@ Parameters: | |
Description: >- | ||
The namespace string used for the bucket key prefix | ||
|
||
S3ToGlueFunctionArn: | ||
S3ToGlueDestinationArn: | ||
Type: String | ||
Description: Arn for the S3 Event Config Lambda Function | ||
Description: Arn for the S3 Event Config Destination | ||
|
||
S3ToGlueDestinationType: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add an |
||
Type: String | ||
Description: The S3 Event Config Destination Type | ||
|
||
S3EventConfigRoleArn: | ||
Type: String | ||
|
@@ -43,7 +47,8 @@ Resources: | |
Environment: | ||
Variables: | ||
S3_SOURCE_BUCKET_NAME: !Ref S3SourceBucketName | ||
S3_TO_GLUE_FUNCTION_ARN: !Ref S3ToGlueFunctionArn | ||
S3_TO_GLUE_DESTINATION_ARN: !Ref S3ToGlueDestinationArn | ||
S3_TO_GLUE_DESTINATION_TYPE: !Ref S3ToGlueDestinationType | ||
BUCKET_KEY_PREFIX: !Ref Namespace | ||
|
||
Outputs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
|
||
Description: > | ||
Creates an SQS queue that gets S3 notifications | ||
|
||
Parameters: | ||
|
||
MessageRetentionPeriod: | ||
Type: Number | ||
Default: 1209600 | ||
Description: How long to retain messages in the primary queue. | ||
|
||
ReceiveMessageWaitTimeSeconds: | ||
Type: Number | ||
Default: 20 | ||
Description: The delay between SQS receiving a message and making it available for others to poll | ||
|
||
VisibilityTimeout: | ||
Type: Number | ||
Default: 120 | ||
Description: >- | ||
How long our lambda has to submit the messages to Glue and | ||
delete the message from the SQS queue | ||
|
||
S3SourceBucketArn: | ||
Type: String | ||
Description: Arn of the S3 bucket where source data are stored. | ||
|
||
Resources: | ||
|
||
PrimaryQueue: | ||
Type: AWS::SQS::Queue | ||
Properties: | ||
DelaySeconds: 0 | ||
MessageRetentionPeriod: !Ref MessageRetentionPeriod | ||
QueueName: !Sub '${AWS::StackName}-Queue' | ||
ReceiveMessageWaitTimeSeconds: !Ref ReceiveMessageWaitTimeSeconds | ||
VisibilityTimeout: !Ref VisibilityTimeout | ||
|
||
PrimaryQueuePolicy: | ||
Type: AWS::SQS::QueuePolicy | ||
Properties: | ||
PolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Sid: Send_Permission | ||
Effect: Allow | ||
Principal: | ||
AWS: !Sub '${AWS::AccountId}' | ||
Action: | ||
- SQS:SendMessage | ||
Resource: !GetAtt PrimaryQueue.Arn | ||
Condition: | ||
ArnLike: | ||
"aws:SourceArn": !Ref S3SourceBucketArn | ||
Queues: | ||
- !Ref PrimaryQueue | ||
|
||
Outputs: | ||
|
||
PrimaryQueueArn: | ||
Value: !GetAtt PrimaryQueue.Arn | ||
Export: | ||
Name: !Sub '${AWS::Region}-${AWS::StackName}-PrimaryQueueArn' | ||
|
||
PrimaryQueueUrl: | ||
Value: !Ref PrimaryQueue | ||
Export: | ||
Name: !Sub '${AWS::Region}-${AWS::StackName}-PrimaryQueueUrl' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
Don't we want an analogous config file in
config/prod
?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.
Likewise for the s3-event-config-lambda
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.
I guess when I originally created this PR, I wasn't sure if we were going to push this right away or leave it in dev branch to avoid messing with production. Based on our recent discussion, it seems like we should be okay to also have it in prod so will do.
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.
Sure. It will exist independently of everything else for now. We do modify the behavior of the event config lambda, but we aren't using it right now so it shouldn't matter.