aws-lambda-zombie-workshop | walkthrough labs to set up a serverless chat | Serverless library
kandi X-RAY | aws-lambda-zombie-workshop Summary
kandi X-RAY | aws-lambda-zombie-workshop Summary
The Zombie Microservices Workshop introduces the basics of building serverless applications using AWS Lambda, Amazon API Gateway, Amazon DynamoDB, Amazon Cognito, Amazon SNS, and other AWS services. In this workshop, as a new member of the AWS Lambda Signal Corps, you are tasked with completing the development of a serverless survivor communications system during the Zombie Apocalypse.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of aws-lambda-zombie-workshop
aws-lambda-zombie-workshop Key Features
aws-lambda-zombie-workshop Examples and Code Snippets
Community Discussions
Trending Discussions on Serverless
QUESTION
Not able to figure out why in upload.js file in the below code snippet is throwing me an error: app.get is not a function.
I have an index.js file where I have configured everything exported my app by module.exports = app and also I have app.set("upload") in it, but when I am trying to import app in upload.js file and using it, it is giving an error error: app.get is not a function.
below is the code of the index.js
...ANSWER
Answered 2022-Mar-23 at 08:55The problem is that you have a circular dependency.
App requires upload, upload requires app.
Try to pass app as a parameter and restructure upload.js to look like:
QUESTION
Edit: Changed title to reflect the problem properly.
I am trying to pick the exact type definition of a specific property inside a interface, but the property is a mapped type [key: string]:
. I tried accessing it using T[keyof T]
because it is the only property inside that type but it returns never
type instead.
is there a way to like Pick
or Interface[[key: string]]
to extract the type?
The interface I am trying to access is type { AWS } from '@serverless/typescript';
ANSWER
Answered 2022-Feb-27 at 19:04You can use indexed access types here. If you have an object-like type T
and a key-like type K
which is a valid key type for T
, then T[K]
is the type of the value at that key. In other words, if you have a value t
of type T
and a value k
of type K
, then t[k]
has the type T[K]
.
So the first step here is to get the type of the functions
property from the AWS
type:
QUESTION
based on the aws documentation, maximum timeout limit is less that 30 seconds in api gateway.so hooking up an sagemaker endpoint with api gateway wouldn't make sense, if the request/response is going to take more than 30 seconds. is there any workaround ? adding a lambda in between api gateway and sagemaker endpoint is going to add more time to process request/response, which i would like to avoid. also, there will be added time for lambda cold starts and sagemaker serverless endpoints are built on top of lambda so that will also add cold start time. is there a way to invoke the serverless sagemaker endpoints , without these overhead?
...ANSWER
Answered 2022-Feb-25 at 08:19You can connect SageMaker endpoints to API Gateway directly, without intermediary Lambdas, using mapping templates https://aws.amazon.com/fr/blogs/machine-learning/creating-a-machine-learning-powered-rest-api-with-amazon-api-gateway-mapping-templates-and-amazon-sagemaker/
You can also invoke endpoints with AWS SDKs (eg CLI, boto3), no need to do it for API GW necessarily.
QUESTION
I am trying to submit google dataproc batch job. As per documentation Batch Job, we can pass subnetwork
as parameter. But when use, it give me
ERROR: (gcloud.dataproc.batches.submit.spark) unrecognized arguments: --subnetwork=
Here is gcloud command I have used,
...ANSWER
Answered 2022-Feb-01 at 11:28According to dataproc batches docs, the subnetwork URI needs to be specified using argument --subnet
.
Try:
QUESTION
I have created a SAM template with a function in it. After deploying SAM the lambda function gets added and are also displayed while adding lambda function trigger in cognito but when I save it gives a 404 error.
SAM template
...ANSWER
Answered 2021-Dec-24 at 11:44You can change to old console, set lambda trigger, it's worked. Then you can change to new console again.
QUESTION
Im using Serverless Framework to deploy a Docker image running R to an AWS Lambda.
...ANSWER
Answered 2021-Dec-15 at 23:26The way your events.http is configured looks wrong. Try replacing it with:
QUESTION
I'd like to use CockroachDB Serverless for my Ecto application. How do I specify the connection string?
I get an error like this when trying to connect.
...ANSWER
Answered 2021-Oct-28 at 00:48This configuration allows Ecto to connect to CockroachDB Serverless correctly:
QUESTION
I have created a RDS cluster with 2 instances using terraform. When I am upgrading the RDS from front-end, it modifies the cluster. But when I do the same using terraform, it destroys the instance.
We tried create_before_destroy, and it gives error.
We tried with ignore_changes=engine but that didn't make any changes.
Is there any way to prevent it?
...ANSWER
Answered 2021-Oct-30 at 13:04Terraform is seeing the engine version change on the instances and is detecting this as an action that forces replacement.
Remove (or ignore changes to) the engine_version
input for the aws_rds_cluster_instance
resources.
AWS RDS upgrades the engine version for cluster instances itself when you upgrade the engine version of the cluster (this is why you can do an in-place upgrade via the AWS console).
By excluding the engine_version
input, Terraform will see no changes made to the aws_rds_cluster_instance
s and will do nothing.
AWS will handle the engine upgrades for the instances internally.
If you decide to ignore changes, use the ignore_changes
argument within a lifecycle
block:
QUESTION
ANSWER
Answered 2021-Nov-02 at 10:00Converted all imports to require()
and all exports to module.exports
Removed "type": "module"
from package.json
Everything works like a charm. It is not a solution to the question asked but making things work became more important.
QUESTION
We are a team of 5 developers working on a video rendering implementation. This implementation consists out of two parts.
- A live video preview in the browser using angular + konva.
- A node.js (node 14) serverless (AWS lambda container) implementation using konva-node that pipes frames to ffmpeg for rendering a mp4 video in higher quality for later download.
Both ways are working for us. Now we extracted the parts of the animation that are the same for frontend and backend implementation to an internal library. We imported them in BE and FE. That also works nicely for most parts.
We noticed here that konva-node is deprecated since a short time. Documentation says to use canvas
+ konva
instead on node.js. But this just doesn't work. If we don't use konva-node we cannot create a stage without a 'container'
value. Also we cannot create a raw image buffer anymore, because stage.toCanvas()
actually returns a HTMLCanvas, which does not have this functionality.
- So what does konva-node actually do to konva API?
- Is node.js still supported after deprecation of konva-node?
- How can we get
toBuffer()
andnew Stage()
functionality without konva-node in node.js?
ANSWER
Answered 2021-Sep-27 at 21:36So what does konva-node actually do to konva API?
It slightly patches Konva code to use canvas
nodejs library to use 2d canvas API. So, Konva will not use browser DOM API.
Is node.js still supported after deprecation of konva-node?
Yes. https://github.com/konvajs/konva#4-nodejs-env
How can we get toBuffer() and new Stage() functionality without konva-node in node.js?
You can try to use this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install aws-lambda-zombie-workshop
The survivor chat uses Amazon Cognito for authentication. Cognito Federated Identity enables you to authenticate users through an external identity provider and provides temporary security credentials to access your app’s backend resources in AWS or any service behind Amazon API Gateway. Amazon Cognito works with external identity providers that support SAML or OpenID Connect, social identity providers (such as Facebook, Twitter, Amazon) and you can also integrate your own identity provider. In addition to federating 3rd party providers such as Facebook, Google, and other providers, Cognito also offers a new built-in Identity Provider called Cognito User Pools. A Cognito Federated Identity pool has already been created for you when you launched CloudFormation. You will now setup the Cognito User Pool as the user directory of your chat app survivors and configure it as a valid Authentication Provider with the Cognito Federated Identity Pool. API Gateway has been configured with IAM Authorization to only allow requests that are signed with valid AWS permissions. When a user signs into the Survivor Chat App (User Pool) successfully, a web call is made to the Cognito Federated Identity Pool to assume temporary AWS credentials for your authenticated user. These credentials are used to make signed AWS SigV4 HTTPS requests to your message API. 1. Navigate to the Cognito service console. Cognito User Pools is not available in all AWS regions. Please review the list here for the regions that Cognito is available in. Therefore if you launched your CloudFormation stack in any region other than one of those listed on the above website, then please use the top navigation bar in the management console to switch AWS regions and navigate to us-east-1 (Virginia) to configure Cognito. Your application will stay hosted in the region you launched the CloudFormation template, but the authentication with Cognito will reside in us-east-1 (Virginia). If you launched the Cloudformation stack in one of those regions where Cognito exists, then please simply navigate to the Cognito service in the AWS Management Console as the service is available in that region already and you will configure it within that region. When inside the Cognito service console, click the blue button Manage your User Pools. You will setup the user directory that your chat application users will authenticate to when they use your app. 2. Click the blue button Create a User Pool in the upper right corner. You'll create a new user directory. 3. In the "Pool Name" text box, name your user pool [Your CloudFormation stack name]-userpool. For example, if you named your CloudFormation stack "sample" earlier, then your user pool name would be "sample-userpool". After naming your User Pool, click Step through Settings to continue with manual setup. 4. On the attributes page, select the "Required" checkbox for the following attributes: email, name, phone number. 5. Click the link "Add custom attribute". Leave all the defaults and type a "Name" of slackuser exactly as typed here. Add 2 additional custom attributes: slackteamdomain and camp.
Cognito User Pools allows you to define attributes that you'd like to associate with users of your application. These represent values that your users will provide when they sign up for your app. They are available to your application as a part of the session data provided to your client apps when users authenticate with Cognito.
Within a User Pool, you can specify custom attributes which you define when you create the User Pool. For the Zombie Survivor chat application, we will include 3 custom attributes.
We will not require MFA for this application. However, for during sign up we are requiring verification via email address. This is denoted with the email checkbox selected for "Do you want to require verification of emails or phone numbers?". With this setting, when users sign up for the application, a confirmation code will be sent to their email which they'll be required to input into the application for confirmation.
Cognito User Pools allows developers to inject custom workflow logic into the signup and signin process. This custom workflow logic is represented with AWS Lambda functions known as Lambda Triggers.
With this feature, developers can pass information to a Lambda function and specify that function to invoke at different stages of the signup/signin process, allowing for a serverless and event driven authentication process.
In this application, we will create two (2) Lambda triggers: Post-Confirmation: This trigger will invoke after a user successfully submits their verification code upon signup and becomes a confirmed user. The Lambda function associated with this trigger takes the attributes provided by the user and inserts them into a custom Users table in DynamoDB that was created with CloudFormation. This allows us to perform querying of user attributes within our application. Pre-Authentication: This trigger will invoke when a user's information is submitted for authentication to Cognito each time the survivor signs into the web application. The code for with this Lambda Trigger takes the user's attributes have been passed in as parameters from the invoking User Pool and using them to perform an update on the User's record in DynamoDB Users table. This allows us to load the user's data into DynamoDB when they initially sign in and also keep it current with the values in User Pools in an on-going basis as they log in each time. For this workshop we use the same backend Lambda function for both of the triggers. On invocation, the function checks what type of even has occurred, Post-Confirmation or Pre-Authentication, and executes the correct code accordingly.
An Amazon Cognito Identity Pool has been configured for you. Identity Pools allow external federated users to assume temporary credentials from AWS to make service API calls from within your apps.
You've just created the User Pool for authentication into your app. Now your users still need access to make IAM Authorized AWS API calls.
You'll setup federation inside of Cognito Identity and allow your User Pool as an Authentication Provider.
When users authenticate into the application, they become an authenticated user, and the application allows them to send chat messages to the survivor chat.
If you changed regions to configure Cognito, please return back to the region where you launched the stack and navigate to the S3 service.
In the S3 Console search bar you can type s3bucketforwebsitecontent and your S3 bucket will display.
Your serverless javascript zombie application requires this constants values in file communicate with the different services of the workshop.
The Identity Pool Id was automatically filled in with several other variables when the CloudFormation template was launched.
Your application now has the configuration it needs to interact with Cognito.
If you already had the application opened in your browser, please refresh the page so that the new constants.js loads with the app.
Select your Camp: Specify the geography where you live! Currently this attribute is not used in the application and is available for those that want to tackle an extra credit opportunity!. When you're done with the workshop, try and tackle the Channel Challenge in the Appendix.
Slack Username: Type the Slack Username you will use during the Slack lab of this workshop. This associates your Slack username with your Survivor app user account and is required if you want to do the Slack lab.
Slack Team Domain Name: Slack users can be members of many teams. Type the Slack team domain name that you want to integrate with this survivor chat app. The combination of a Slack team domain and Slack Username will unique identity a user to associate with your new Survivor chat app account.
If you are getting errors during the signup, please revisit the settings for your Cognito User Pool. You need to make sure that you've done the following - Configured your Cognito Lambda triggers for both the Pre-Authentication and Post-Confirmation steps as described in Step 10. Properly modified the constants.js config file and re-uploaded it to the JS directory for your application in S3. After you uploaded this constants.js file, you should have refreshed your zombie chat browser application page so that it could pull down the latest JS files. The application is client-side and needs this file's properties in order to bootstrap itself.
Users created in the application are also stored in a DynamoDB table named "Users". If you did not have your Cognito triggers set up correctly, you will need to navigate to the DynamoDB Users table and delete the entry for your user. You can then re-register in the application again.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page