How you can test your AWS cloud infrastructure locally with Pytest and LocalStack inside a Docker containers

Image from LocalStack documentation

If you did not know too much about what LocalStack is, it's a way you almost can test AWS services locally before your deploy your code, and its support running inside a Docker container so you can use it inside your CI/CD pipeline, if you want to read the basic about LocalStack you can read my article Test your Amazon Web Service (AWS) services locally before deploying them into the cloud and waste money with LocalStack — AWS where you will learn how to get up and running with LocalStack.

You can expect to learn about how to use LocalStack inside your CI/CD pipeline when you need to test AWS services from Pytest and how you can link 2 Docker containers together in the same network to communicate better, and we will build some AWS CDK code to deploy our stack for testing, all the code will not we in this article, it can be found on my GitHub in the following repository.

Creating the test stack with a Lambda function and a Lambda layer

--

--

Paris Nakita Kejser
DevOps Engineer, Software Architect and Software Developering

DevOps Engineer, Software Architect, Software Developer, Data Scientist and identify me as a non-binary person.