Home Explore Blog CI



docker

3rd chunk of `content/guides/localstack.md`
2432d58058100a6922d244e8de276d6942b716a93806a7ca0000000100000826


4. Creating a Local Amazon S3 Bucket

   When you create a local S3 bucket using LocalStack, you're essentially simulating the creation of an S3 bucket on AWS. This lets you to test and develop applications that interact with S3 without needing an actual AWS account.

   To create Local Amazon S3 bucket, you’ll need to install an `awscli-local` package to be installed on your system. This package provides the awslocal command, which is a thin wrapper around the AWS command line interface for use with LocalStack.  It lets you to test and develop against a simulated environment on your local machine without needing to access the real AWS services. You can learn more about this utility [here](https://github.com/localstack/awscli-local).

    ```console
    $ pip install awscli-local
    ```

    Create a new S3 bucket within the LocalStack environment with the following command:

    ```console
    $ awslocal s3 mb s3://mysamplebucket
    ```

    The command `s3 mb s3://mysamplebucket` tells the AWS CLI to create a new S3 bucket (mb stands for `make bucket`) named `mysamplebucket`.

    You can verify if the S3 bucket gets created or not by selecting the LocalStack container on the Docker Desktop Dashboard and viewing the logs. The logs indicates that your LocalStack environment is configured correctly and you can now use the `mysamplebucket` for storing and retrieving objects.

    ![Diagram showing the logs of LocalStack that highlights the S3 bucket being created successfully ](./images/localstack-s3put.webp)

## Using LocalStack in development

Now that you've familiarized yourself with LocalStack, it's time to see it in action. In this demonstration, you'll use a sample application featuring a React frontend and a Node.js backend. This application stack utilizes the following components:

- React: A user-friendly frontend for accessing the todo-list application
- Node: A backend responsible for handling the HTTP requests.
- MongoDB: A database to store all the to-do list data

Title: Creating and Verifying a Local Amazon S3 Bucket with LocalStack
Summary
The section describes how to create a local S3 bucket within the LocalStack environment using the `awscli-local` package. This package allows interaction with LocalStack services using a command-line interface. The process involves installing `awscli-local` using pip, then using the `awslocal s3 mb s3://mysamplebucket` command to create the bucket. Verification is done by checking LocalStack container logs in Docker Desktop for successful bucket creation. Finally, the section introduces a sample application with React, Node.js, and MongoDB, set up to interact with LocalStack services.