-
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.
- Loading branch information
Showing
13 changed files
with
760 additions
and
5 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
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: lambda-raw-role.yaml | ||
stack_name: "{{ stack_group_config.namespace }}-lambda-raw-role" | ||
dependencies: | ||
- develop/namespaced/sqs-dispatch-to-raw.yaml | ||
- develop/s3-cloudformation-bucket.yaml | ||
- develop/s3-raw-bucket.yaml | ||
parameters: | ||
SQSQueueArn: !stack_output_external "{{ stack_group_config.namespace }}-sqs-dispatch-to-raw::PrimaryQueueArn" | ||
S3SourceBucketName: {{ stack_group_config.input_bucket_name }} | ||
S3TargetBucketName: {{ stack_group_config.raw_bucket_name }} | ||
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,17 @@ | ||
template: | ||
type: sam | ||
path: src/lambda_function/raw/template.yaml | ||
artifact_bucket_name: {{ stack_group_config.template_bucket_name }} | ||
artifact_prefix: "{{ stack_group_config.namespace }}/src/lambda" | ||
dependencies: | ||
- develop/namespaced/lambda-raw-role.yaml | ||
- develop/namespaced/sqs-dispatch-to-raw.yaml | ||
- develop/s3-cloudformation-bucket.yaml | ||
- develop/s3-raw-bucket.yaml | ||
stack_name: "{{ stack_group_config.namespace }}-lambda-raw" | ||
parameters: | ||
RoleArn: !stack_output_external "{{ stack_group_config.namespace }}-lambda-raw-role::RoleArn" | ||
SQSQueueArn: !stack_output_external "{{ stack_group_config.namespace }}-sqs-dispatch-to-raw::PrimaryQueueArn" | ||
S3RawBucket: {{ stack_group_config.raw_bucket_name }} | ||
S3RawKeyPrefix: "{{ stack_group_config.namespace }}/json/" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
template: | ||
path: lambda-raw-role.yaml | ||
stack_name: "{{ stack_group_config.namespace }}-lambda-raw-role" | ||
dependencies: | ||
- prod/namespaced/sqs-dispatch-to-raw.yaml | ||
- prod/s3-cloudformation-bucket.yaml | ||
- prod/s3-raw-bucket.yaml | ||
parameters: | ||
SQSQueueArn: !stack_output_external "{{ stack_group_config.namespace }}-sqs-dispatch-to-raw::PrimaryQueueArn" | ||
S3SourceBucketName: {{ stack_group_config.input_bucket_name }} | ||
S3TargetBucketName: {{ stack_group_config.raw_bucket_name }} | ||
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,17 @@ | ||
template: | ||
type: sam | ||
path: src/lambda_function/raw/template.yaml | ||
artifact_bucket_name: {{ stack_group_config.template_bucket_name }} | ||
artifact_prefix: "{{ stack_group_config.namespace }}/src/lambda" | ||
dependencies: | ||
- prod/namespaced/lambda-raw-role.yaml | ||
- prod/namespaced/sqs-dispatch-to-raw.yaml | ||
- prod/s3-cloudformation-bucket.yaml | ||
- prod/s3-raw-bucket.yaml | ||
stack_name: "{{ stack_group_config.namespace }}-lambda-raw" | ||
parameters: | ||
RoleArn: !stack_output_external "{{ stack_group_config.namespace }}-lambda-raw-role::RoleArn" | ||
SQSQueueArn: !stack_output_external "{{ stack_group_config.namespace }}-sqs-dispatch-to-raw::PrimaryQueueArn" | ||
S3RawBucket: {{ stack_group_config.raw_bucket_name }} | ||
S3RawKeyPrefix: "{{ stack_group_config.namespace }}/json/" | ||
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,36 @@ | ||
# Raw Lambda | ||
|
||
The raw Lambda polls the dispatch-to-raw SQS queue and uploads an object to the raw S3 bucket. | ||
Its purpose is to compress a single JSON file from an export (zip archive) and store it to S3. | ||
It makes heavy use of Python file objects and multipart uploads and can download/compress/upload | ||
with a relatively low, fixed memory overhead with respect to the size of the uncompressed JSON. | ||
|
||
## Development | ||
|
||
The Serverless Application Model Command Line Interface (SAM CLI) is an | ||
extension of the AWS CLI that adds functionality for building and testing | ||
Lambda applications. | ||
|
||
To use the SAM CLI, you need the following tools. | ||
|
||
* SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) | ||
* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) | ||
|
||
You may need the following for local testing. | ||
* [Python 3 installed](https://www.python.org/downloads/) | ||
|
||
You will also need to configure your AWS credentials, if you have not already done so. | ||
|
||
## Creating a local build | ||
|
||
Use the SAM CLI to build and test your lambda locally. | ||
Build your application with the `sam build` command. | ||
|
||
```bash | ||
cd src/lambda_function/raw/ | ||
sam build | ||
``` | ||
|
||
## Tests | ||
|
||
Tests are available in `tests/test_raw_lambda.py`. |
Oops, something went wrong.