What Happened
Select a session to learn more about it.
How To Test Serverless Applications In AWS
What
99 Minute WorkshopDescription
In the past few years, serverless architecture has become very popular, as it removed the burden of managing infrastructure, such as servers, storage, databases, scalability, etc.
With this simplicity comes a few challenges around testing:
Testing locally is complex due to the distributed nature of serverless applications.
On the opposite of monoliths applications, where most of the risk lies in the actual code implementation, the risk increases in serverless apps around configuration and integration, making our integration tests more critical.
What are we supposed to test? How do we test our app on both unit and integration levels? How can we make sure our app will work properly in a live environment, given we've mocked other services while developing on our local? How can we test the interaction with the cloud services (AWS services in this case) without having to test the service itself?
We will try to answer these questions by going over a project that uses some AWS serverless services and detailing its testing from A to Z. We will touch on the following as part of this meetup:
- Introduction to services used in the project
- Unit testing using Jest and bash
- Integration testing
- Deployment and traffic shifting in CodeDeploy
Takeaways
- Describe how serverless apps work and identify the serverless components used in the project
- Create unit tests for the serverless components used and outline their importance
- Create lambda hooks and identify their relationship to integration tests and safe deployment
Prerequisites
Basic knowledge in using command line and bash script and basic knowledge of Javascript.
Below are a few steps that would help setting up the local environment:
-
Install Node.js and npm
-
Go to https://nodejs.org/en/ to download, and then install the LTS (Recommended for most users)
-
npm is installed automatically with NodeJS; when you install node, you get npm with it
-
Verify the installation: node -v
-
-
Install Git (https://git-scm.com/downloads)
-
Install vscode or any other code editor you prefer
-
Clone the following repository: https://github.com/AHaydar/companies-data-demo
-
Navigate to the “API” folder and run: npm install
-
(Optional) Most of the work will happen in the local environment. However, if you wish to follow through with the deployment on AWS, you would need to create an AWS account: https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/.
-
Note there might be charges for using some AWS services (the cost of spinning up and using the resources needed for the workshop is not significant - should not exceed a few cents)
-
It is recommended to set up a billing alert to notify the account admin when the costs exceed a certain amount: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html.
Speaker
Frequently Asked Questions
Are the Workshops Recorded?
Our 99-minute workshops are designed to be attended live. If you can’t make the scheduled time, we will add highlights of the workshop in the future once the workshops are complete.