Moto
Our great sponsors
aws-lambda-runtime-interface-emulator | Moto | |
---|---|---|
4 | 32 | |
862 | 7,339 | |
1.7% | 1.4% | |
5.2 | 9.9 | |
8 days ago | 6 days ago | |
Go | Python | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
aws-lambda-runtime-interface-emulator
-
Understanding the AWS Lambda Runtime API
Enter the aws-lambda-runtime-interface-emulator. This tool will allow us to emulate the AWS Lambda Runtime API locally (I suspect that the AWS SAM uses this tool under the hood as well). The aws-lambda-runtime-interface-emulator is designed to be used with Docker. Still, nothing stops us from containerizing our code for the sake of development and then, whenever we are ready, proceeding with deployment how we wish to. This local workflow is a bit more involved than the previous one, but it might be a valid alternative for those not using AWS SAM or are already using containers to deploy their Lambdas.
-
Puppeteer performance in AWS Lambda Docker containers
There is a special tool to test AWS Lambda images locally. It's called AWS Lambda Runtime Interface Emulator (RIE). You have two options: include RIE in your image or install it locally. We don't need it in the production image, so let's choose the second option. We will download binary locally and mount it to our image if we need to test it.
-
Ask HN: Does anyone else find the AWS Lambda developer experience poor?
Suggestions:
1. If you are building APIs and using Lambda functions as targets from an API Gateway API, look into libraries like serverless-wsgi (Python) or wai-handler-hal (Haskell) that translate between API Gateway request/response payloads and some kind of ecosystem-native representation. Then as long as you're writing code where all state gets persisted outside of the request/response cycle, you can develop locally as if you were writing for a more normal deploy environment.
2. Look into the lambda runtime interface emulator ( https://github.com/aws/aws-lambda-runtime-interface-emulator... ). This lets you send invoke requests to a fake listener and locally test the lambda more easily. While the emulator is provided in the AWS container base images, you don't need to run it inside a container if you're deploying with zip files. (AWS-provided container images automatically enable the emulator if not running in a lambda runtime environment, and using docker for port remapping is nice. But not at all required.)
3. Get really good at capturing all requests to external services, and mocking them out for local testing. Whether this is with free monads, effect systems, gateway classes will depend on your language and library choices.
Moto
-
OpenTF Announces Fork of Terraform
> OpenMoto
I dunno if you're trying to play on "hashimoto" but https://github.com/getmoto/moto#readme would be a prime name collision for any such "OpenMoto" name
But yes, please, to adopting Vault. I don't have a horse in the race about Consul but my suspicion is such an effort would only be worthwhile if trying to adopt Nomad, too, which I gravely doubt
-
What is the development enviroment for AWS?
If using Python use Moto to mock AWS Services
-
Guide to AWS Serverless & Lambda Testing Best Practices — Part 1
The Pythonic motto library mocks AWS services, removing the need to deploy your application or pay for API calls against AWS services. Other programming languages have their motto implementation.
- Final FLiP Stack Weekly of 2022
-
Do unit tests make sense here?
To add on to the integration tests point, for mocking out your AWS resources you should check out moto if you don't want run your test against real AWS resources as they may cost you and is usually slower.
-
Do some developers actually, REALLY, have no local environment and run everything in AWS? Is the individual cloud dev environment a real alternative to having things running locally?
You should be able to unit test your application on any device. (I use moto to help there.) And then when you want to ensure that you've given your lambda the right security groups or whatever, you deploy to a real but non-production lambda, and that deployment can be from anywhere.
-
Getting started with testing DynamoDB code in Python
The Python package moto bundles mocks for many AWS services, including DynamoDB. The DynamoDB mock behaves mainly like the service - we can create tables, add data, query data, remove data, and much more. Not all features are supported, though - the documentation lists the available API calls. We can use this in combination with pytest to create a simple test setup.
-
Mocking AWS Dynamo Db calls during testing
moto is an amazing library to mock any AWS Dynamo DB based calls. You can check out the development on their GitHub page.
- How to handle cloud resources in your application while running localhost
- Localstack – Local AWS Emulator
What are some alternatives?
LocalStack - 💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline
aws-sdk-go - AWS SDK for the Go programming language.
aws-cdk-local - Thin wrapper script for using the AWS CDK CLI with LocalStack
VCR.py - Automatically mock your HTTP interactions to simplify and speed up testing
responses - A utility for mocking out the Python Requests library.
freezegun - Let your Python tests travel through time
Mocket - a socket mock framework - for all kinds of socket animals, web-clients included
betamax - A VCR imitation designed only for python-requests.
mock - The Python mock library
httpretty - Intercept HTTP requests at the Python socket level. Fakes the whole socket module
S3Mock - A simple mock implementation of the AWS S3 API startable as Docker image, TestContainer, JUnit 4 rule, JUnit Jupiter extension or TestNG listener
serverless-application-model - The AWS Serverless Application Model (AWS SAM) transform is a AWS CloudFormation macro that transforms SAM templates into CloudFormation templates.