-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stacks related to dispatch Lambda
- Loading branch information
1 parent
910966c
commit 66ef98a
Showing
8 changed files
with
155 additions
and
9 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
template: | ||
path: lambda-dispatch-role.yaml | ||
stack_name: "{{ stack_group_config.namespace }}-lambda-dispatch-role" | ||
dependencies: | ||
- develop/namespaced/sqs-input-to-dispatch.yaml | ||
parameters: | ||
SQSQueueArn: !stack_output_external "{{ stack_group_config.namespace }}-sqs-input-to-dispatch::PrimaryQueueArn" | ||
S3SourceBucketName: {{ stack_group_config.input_bucket_name }} | ||
SNSTopicArn: !stack_output_external "{{ stack_group_config.namespace }}-sns-dispatch::SnsTopicArn" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
template: | ||
type: sam | ||
path: src/lambda_function/dispatch/template.yaml | ||
artifact_bucket_name: {{ stack_group_config.template_bucket_name }} | ||
artifact_prefix: "{{ stack_group_config.namespace }}/src/lambda" | ||
dependencies: | ||
- develop/namespaced/lambda-dispatch-role.yaml | ||
- develop/namespaced/sqs-input-to-dispatch.yaml | ||
- develop/s3-cloudformation-bucket.yaml | ||
stack_name: "{{ stack_group_config.namespace }}-lambda-dispatch" | ||
stack_tags: {{ stack_group_config.default_stack_tags }} | ||
parameters: | ||
RoleArn: !stack_output_external "{{ stack_group_config.namespace }}-lambda-dispatch-role::RoleArn" | ||
SQSQueueArn: !stack_output_external "{{ stack_group_config.namespace }}-sqs-input-to-dispatch::PrimaryQueueArn" | ||
DispatchSnsArn: !stack_output_external "{{ stack_group_config.namespace }}-sns-dispatch::SnsTopicArn" |
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,9 @@ | ||
template: | ||
path: sns-topic.yaml | ||
dependencies: | ||
- develop/namespaced/lambda-dispatch.yaml | ||
parameters: | ||
LambdaSourceArn: !stack_output_external "{{ stack_group_config.namespace }}-lambda-dispatch::DispatchFunctionArn" | ||
stack_name: "{{ stack_group_config.namespace }}-sns-dispatch" | ||
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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
|
||
Transform: AWS::Serverless-2016-10-31 | ||
|
||
Description: > | ||
An IAM Role for the dispatch lambda | ||
Parameters: | ||
SQSQueueArn: | ||
Type: String | ||
Description: ARN of the SQS queue for lambda to poll messages from. | ||
|
||
S3SourceBucketName: | ||
Type: String | ||
Description: Name of the S3 bucket where exports are deposited. | ||
|
||
SNSTopicArn: | ||
Type: String | ||
Description: ARN of the SNS topic which dispatched jobs will be published to. | ||
|
||
Resources: | ||
DispatchRole: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
AssumeRolePolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Effect: Allow | ||
Principal: | ||
Service: | ||
- lambda.amazonaws.com | ||
Action: | ||
- sts:AssumeRole | ||
ManagedPolicyArns: | ||
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole | ||
Policies: | ||
- PolicyName: PollSQSQueue | ||
PolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Effect: Allow | ||
Action: | ||
- sqs:DeleteMessage | ||
- sqs:GetQueueAttributes | ||
- sqs:ReceiveMessage | ||
Resource: | ||
- !Ref SQSQueueArn | ||
- PolicyName: ReadS3 | ||
PolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Effect: Allow | ||
Action: | ||
- s3:Get* | ||
- s3:List* | ||
Resource: | ||
- !Sub arn:aws:s3:::${S3SourceBucketName} | ||
- !Sub arn:aws:s3:::${S3SourceBucketName}/* | ||
- PolicyName: PublishToSNS | ||
PolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Effect: Allow | ||
Action: | ||
- sns:Publish | ||
Resource: | ||
- !Ref SNSTopicArn | ||
|
||
Outputs: | ||
RoleName: | ||
Value: !Ref DispatchRole | ||
Export: | ||
Name: !Sub '${AWS::Region}-${AWS::StackName}-RoleName' | ||
|
||
RoleArn: | ||
Value: !GetAtt DispatchRole.Arn | ||
Export: | ||
Name: !Sub '${AWS::Region}-${AWS::StackName}-RoleArn' |
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