Skip to content
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

feat(aws-kinesisstreams-lambda): Add ability to bring-your-own stream #60

Merged
merged 1 commit into from
Sep 11, 2020
Merged

feat(aws-kinesisstreams-lambda): Add ability to bring-your-own stream #60

merged 1 commit into from
Sep 11, 2020

Conversation

dscpinheiro
Copy link
Contributor

Issue #, if available: #58

Description of changes: This PR adds the ability to bring an existing Kinesis stream to the aws-kinesisstreams-lambda pattern. There's also a breaking change in the pattern interface (described below).

BREAKING CHANGE: DefaultKinesisEventSourceProps was removed from lambda-event-source-mapping-defaults and replaced with KinesisEventSourceProps. This now follows the same behavior as the aws-dynamodb-stream-lambda and aws-s3-lambda patterns (which use DynamoEventSourceProps and S3EventSourceProps instead of EventSourceMappingOptions)


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…s Stream to this pattern

BREAKING CHANGE: DefaultKinesisEventSourceProps was removed from lambda-event-source-mapping-defaults and replaced with KinesisEventSourceProps. This now follows the same behavior as the aws-dynamodb-stream-lambda and aws-s3-lambda patterns (which use DynamoEventSourceProps and S3EventSourceProps instead of EventSourceMappingOptions)
@@ -249,6 +252,16 @@ Object {
],
},
},
Object {
"Action": "kinesis:DescribeStream",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add this specific permissions, it looks like it was just missing from the latest snapshot.

import * as s3 from '@aws-cdk/aws-s3';

export function DefaultKinesisEventSourceProps(_eventSourceArn: string) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function was only being used by the pattern (which now uses KinesisEventSourceProps), so I deleted it.


export function KinesisEventSourceProps(_kinesisEventSourceProps?: KinesisEventSourceProps) {
const defaultKinesisEventSourceProps = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reasoning behind these defaults was:

const stack = new Stack(app, 'test-ks-lambda-stack');
stack.templateOptions.description = 'Integration Test for aws-kinesisstreams-lambda';

const lambdaRole = new iam.Role(stack, 'test-role', {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no integration tests for bringing existing resources, so I created this one.

I'm creating a role separately because the default one the CDK creates does not have permission to write to CloudWatch, and that'd cause a warning from cfn_nag ("W58 Lambda functions require permission to write CloudWatch Logs")

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-rp7jMDIK1wBN
  • Commit ID: dd6616b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@hnishar hnishar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it! Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants