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

EventBus Stack #53

Closed
vasco-santos opened this issue Nov 29, 2022 · 0 comments · Fixed by #55
Closed

EventBus Stack #53

vasco-santos opened this issue Nov 29, 2022 · 0 comments · Fixed by #55

Comments

@vasco-santos
Copy link
Contributor

Based on #50

vasco-santos added a commit that referenced this issue Nov 30, 2022
Adds bus stack with global custom EventBridge (future will also include
Websocket API).

As part of this refactor to use Bus Stack, I also looked into removing
the need to have a lambda function on the Event Bridge exit just to
transform S3Event into a SQS Topic. A new transformation target rules
was created to achieve this. Initially, I intended to keep same
structure as what E-IPFS indexer receives
(`${message.region}/${message.bucketName}/${message.key}`), so that we
could also remove that handler. This ended up not working in any way
with [AWS Events
Rules](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events-readme.html#rule)
+
[InputTransformerProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.CfnRule.InputTransformerProperty.html)
+
[RuleTargetInput](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-events.RuleTargetInput.html).
Ended up just relying on a new JSON string with the expected properties,
which also is nicer because we don't need to apply regexes to remove
things from the string as before. We still need to handle E-IPFS
indexing with a lambda, but that interaction will also change in the
near future.

This was tested with deployed resources and everything is working as
expected - CAR uploaded to CARPARK triggers lambda to copy, and `*.idx`
file is written into SATNAV bucket

Other notes:
- renamed `event-bridge/index.js` file to `event-bridge/source.js` to
better represent what that function does. It is the source event for the
event bridge (so, lambda that forwards S3 Put Event to the Event bridge)
- hooks up writes to Satnav bucket to trigger Events - previously not
done because of stacks circular dependency as described in
#49)

Closes #53
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 a pull request may close this issue.

1 participant