In most cases, these two numbers can be the same, i.e. The number on the left binds the port on your localhost to the port within the container, which is the number on the right. When your docker container starts, it will open up a few ports. This gives our container a specific name that we can refer to later in the CLI. Use the latest Localstack image from Dockerhub container_name: localstack_demo: Thanks to for mentioning this in the comments)īreaking some of these lines down: image: localstack/localstack:latest (Augedit: LocalStack now has a larger range of ports, the yaml above has been updated to reflect this. '/var/run/docker.sock:/var/run/docker.sock' I prefer to use docker-compose to set this up. It's also nice because you don't need to worry about installing Localstack on your system. You can run Localstack directly from the command line, but I like using Docker because it makes me feel smart.
If anyone has any suggestions on how to improve or better explain any of this, please let me know in the comments!)
Thanks to pointing out in the comments that I missed this step! Localstack requires that these details are present, but doesn't actually validate them. You can enter real credentials (as described here), or dummy ones. Even though we're talking to our "fake" local service, we still need credentials. Once the AWS CLI is installed, run aws configure to create some credentials.Even though we aren't going to be working with "real" AWS, we'll use this to talk to our local docker containers. You don't need to worry about paying for AWS usageįirst, we'll need to install a few things.You can easily wipe & replace your local buckets.You don't need a shared 'dev' bucket that everyone on your team uses.You can see the demo repo for the finished code. This also covers a little bit about Docker - if you don't really know what you're doing with Docker or how it works, don't worry. Also, Localstack isn't specific to Node - so even if you aren't working in Node, a good portion of this tutorial will still be relevant. Localstack allows you to emulate a number of AWS services on your computer, but we're just going to use S3 in this example. This tutorial will cover setting up Localstack within a node app. I can't think of a better away to achieve all of the above than putting a bunch of S3 servers inside my computer. Additionally, I'm always looking for new ways to fill up my small hard drive. I also prefer to keep my local development environment as close as possible to how it's going to work in production. Did you set up your IAM root user with 2FA and correctly configure the CORS and ACL settings on your S3 bucket? If you're anything like me, you prefer to avoid logging into the AWS console as much as possible.