Running an EC2 instance locally using LocalStack

In this video, you'll learn how you can run an Elastic Compute Cloud (EC2) instance locally using LocalStack's core cloud emulator. Elastic Compute Cloud (EC2) is a core service within Amazon Web Services (AWS) that provides scalable and flexible virtual computing resources. EC2 enables users to launch and manage virtual servers, commonly referred to as instances. LocalStack is a core cloud emulator that allows you run EC2 instances using a Docker backend. Under the hood, LocalStack spins another Docker container that mimics an EC2 instance functionality, including other add-on features such as EBS, IMDS, and Load Balancers. Corrections: LocalStack will no longer provide the Ubuntu 20.04 Docker AMI (used in this video) by default in the next major release, though it can still be manually added, and on nine minutes & nine seconds mark, we meant 'localhost' instead of 'localstack'. To access the web server, you can hit the localhost:8000 endpoint as shown in the video.

Related Talks

Replicating cloud resources locally with LocalStack's AWS Replicator extension

LocalStack's core cloud emulator lets you emulate various cloud services on your own computer. This means you can develop and test your cloud-based solutions without connecting to a remote cloud. However, there are times when you need to seamlessly switch between your local setup and actual cloud resources, especially in hybrid situations. For instance, you might want to share a database with your local Lambda function or access S3 files stored remotely while running a Glue ETL job locally. With LocalStack's AWS Replicator extension, your local environment can replicate AWS cloud resources at the API level, allowing direct interaction with cloud services. The Replicator extension enables you to forward specific requests from LocalStack to AWS without complex proxy setups, and create test scenarios that involve a mix of local and cloud resources.

Learn More
Learn More
OpenInfraQuote: Wrangling cloud costs with an open source, standalone, Terraform cost estimator

Cloud infrastructure has fueled innovation for nearly two decades—yet cost control remains a challenge. Unforeseen expenses and complicated billing can hamper agility, forcing teams to overspend just to stay competitive. What if you could evaluate costs in real-time, identify inefficiencies, and optimize deployments—without slowing development? Imagine adjusting parameters based on on-the-fly estimates and usage. In this presentation, Malcolm Matalka, Co-founder and CTO of Terrateam, explores how OpenInfraQuote, a new open-source command-line tool, transforms Terraform and OpenTofu code into actionable cost insights. Learn how to automate price checks, compare scenarios, and avoid financial surprises—alongside how it differs from other solutions and how to integrate it into your workflow.

Learn More
Learn More
Multi-account and multi-region in LocalStack

Multi-account and multi-region compatibility enables users to manage and deploy resources across multiple AWS accounts and geographic regions. This functionality enhances the robustness of the deployments by offering improved fault tolerance, scalability, and regulatory compliance. By segregating resources into separate accounts and distributing them across various regions, users can minimize the impact of potential failures and optimize performance. In this session from LocalStack Community Meetup May '24, Sannya Singhal discussed how you could use LocalStack to emulate multi-account and multi-region environments locally for testing and development purposes, ensuring that applications were resilient and scalable before deployment to the cloud.

Learn More
Learn More

Launch yourself in the world of local cloud development

Try for free
Try for free
Talk to Sales
Talk to Sales