Installation

Basic installation guide to get started with LocalStack for Snowflake

Introduction

You can set up the Snowflake emulator by utilizing LocalStack’s Extension mechanism. There are two methods for installing the Snowflake emulator:

Snowflake Docker image

You can use the Snowflake Docker image to run the Snowflake emulator. The Snowflake Docker image is available on the LocalStack Docker Hub. To pull the Snowflake Docker image, execute the following command:

$ docker pull localstack/snowflake

You can start the Snowflake Docker container using the following methods:

  1. localstack CLI
  2. docker CLI
  3. Docker Compose

localstack CLI

To start the Snowflake Docker container using the localstack CLI, execute the following command:

$ export LOCALSTACK_AUTH_TOKEN=<your_auth_token>
$ IMAGE_NAME=localstack/snowflake localstack start

docker CLI

To start the Snowflake Docker container using the docker CLI, execute the following command:

$ docker run \
    --rm -it \
    -p 4566:4566 \
    -e LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?} \
    localstack/snowflake

Docker Compose

Create a docker-compose.yml file with the specified content:

version: "3.8"

services:
  localstack:
    container_name: "localstack-main"
    image: localstack/snowflake
    ports:
      - "127.0.0.1:4566:4566"
    environment:
      - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?}
    volumes:
      - "./volume:/var/lib/localstack"

Start the Snowflake Docker container with the following command:

$ docker-compose up

Updating

To update the Snowflake Docker container, pull the latest image and restart the container. The latest tag is the nightly build of the Snowflake Docker image.

LocalStack Extension mechanism

The LocalStack Extension mechanism allows you to install and manage extensions for LocalStack. Extensions are packaged as Python applications, and can be installed using:

  1. localstack CLI
  2. Docker Compose

localstack CLI

To install the Snowflake emulator using the localstack CLI, execute the following command:

$ localstack extensions install localstack-extension-snowflake

Upon successful installation, you should see the output listing the installed extension.

[20:30:06] Extension successfully installed                                                 extensions.py:86
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ Name                           ┃ Summary                         ┃ Version ┃ Author     ┃ Plugin name ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ localstack-extension-snowflake │ LocalStack Extension: Snowflake │ 0.1.22  │ LocalStack │ snowflake   │
└────────────────────────────────┴─────────────────────────────────┴─────────┴────────────┴─────────────┘

Docker Compose

To install the Snowflake emulator using Docker Compose, use the EXTENSION_AUTO_INSTALL environment variable for automatic extension installation. Create a docker-compose.yml file with the specified content:

version: "3.8"

services:
  localstack:
    container_name: "localstack-main"
    image: localstack/localstack-pro
    ports:
      - "127.0.0.1:4566:4566"
      - "127.0.0.1:4510-4559:4510-4559"
    environment:
      - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?}
      - DEBUG=1
      - EXTENSION_AUTO_INSTALL=localstack-extension-snowflake
    volumes:
      - "./volume:/var/lib/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"

Start the Snowflake emulator with the following command:

$ docker-compose up

Updating

To update the Snowflake emulator using the localstack CLI, uninstall and install the extension again:

$ localstack extensions uninstall localstack-extension-snowflake
$ localstack extensions install localstack-extension-snowflake

For Docker Compose, update the extension by restarting the LocalStack container.

Troubleshooting

How to check if the Snowflake emulator is running?

You can check if the Snowflake emulator is running by executing the following command:

$ curl -d '{}' snowflake.localhost.localstack.cloud:4566/session
{"success": true}

How to enable detailed debug logs?

You can set the SF_LOG=trace environment variable in the Snowflake container to enable detailed trace logs that show all the request/response message.

When using docker-compose then simply add this variable to the environment section of the YAML configuration file. If you’re starting up via the localstack start CLI, then make sure to start up via the following configuration:

$ DOCKER_FLAGS='-e SF_LOG=trace' DEBUG=1 IMAGE_NAME=localstack/snowflake localstack start

Next steps

Now that the Snowflake emulator is installed, you can use it for developing and testing your Snowflake data pipelines. Refer to our Quickstart guide to get started.