A ready-made AWS Lambda function you can invoke to publish messages into Google's PubSub system.
It's really useful for bridging AWS compute with Firebase or other Google Cloud projects.
Follow the guide to setup Workload Identity Federation in your Google Cloud projects.
Then you can deploy the code in this repository as a Node.js Lambda function in your AWS account.
Check out the Releases section for packages and instructions.
Hosted versions are available out of my personal AWS account, should you need to get running quickly. You're encouraged to host it on your own accounts and service is provided without any guarantees or warranty express or implied.
CloudFormation:
https://github-com-hf-pubpubsub-<region>.s3.amazonaws.com/release/cloudformation/<release>
Lambda:
https://github-com-hf-pubpubsub-<region>.s3.amazonaws.com/release/lambda/<release>
Currently available in: us-east-1
, eu-west-1
. Open an issue to
request availability in other regions.
Note that you're only allowed to access the S3 object, not the bucket itself. You must do it using AWS credentials, and your identity will be visible in my CloudTrail account.
The Lambda function expects these environment variables:
GOOGLE_CLOUD_PROJECT_NUMBER
GCP project number where the Workload Identity Federation provider residesGOOGLE_CLOUD_WEB_IDENTITY_POOL
ID of the web identity poolGOOGLE_CLOUD_WEB_IDENTITY_POOL_AWS_PROVIDER
ID of the AWS provider in the web identity poolGOOGLE_CLOUD_SERVICE_ACCOUNT_EMAIL
Service account email to impersonateGOOGLE_CLOUD_DEFAULT_PROJECT_ID
(Optional) Project ID where messages without aprojectId
property will be directed to
The Lambda function can be invoked synchronously or asynchronously.
It accepts a JSON object with the following structure:
topic
Pub/Sub topic to which to publishmessage
A string representing the message to be publishedbase64
(Optional) A boolean whether themesasge
is encoded in Base64projectId
(Optional) GCP project ID where thetopic
lives
It outputs a JSON object with the following structure:
topic
Pub/Sub topic where the message was publishedprojectId
GCP project ID where thetopic
livesmessageId
ID of the message in thetopic
Copyright © 2022 Stojan Dimitrovski. Some rights reserved.
Licensed under the MIT X11 License. You can find a copy of it under LICENSE
.