|
| 1 | +--- |
| 2 | +title: Installation |
| 3 | +description: Installation guide to get started with LocalStack for Snowflake. |
| 4 | +template: doc |
| 5 | +sidebar: |
| 6 | + order: 0 |
| 7 | +--- |
| 8 | + |
| 9 | +import { Code, LinkButton, Tabs, TabItem } from '@astrojs/starlight/components'; |
| 10 | +import { LOCALSTACK_VERSION } from "astro:env/server"; |
| 11 | + |
| 12 | +## LocalStack CLI for Snowflake |
| 13 | + |
| 14 | +The easiest way to get started with LocalStack for Snowflake is by using the LocalStack CLI. It automatically pulls the correct Docker image, manages the container, and supports additional features like image updates and debugging. |
| 15 | + |
| 16 | +## Installing the LocalStack CLI |
| 17 | + |
| 18 | +The LocalStack CLI can be installed using Python, Brew (macOS), or Windows executables. |
| 19 | + |
| 20 | + |
| 21 | +<Tabs> |
| 22 | + |
| 23 | +<TabItem label="Python" value="python"> |
| 24 | + |
| 25 | +If you prefer to install LocalStack via Python (recommended for most Snowflake users), follow the steps below. |
| 26 | + |
| 27 | +Please ensure the following are installed: |
| 28 | + |
| 29 | +- [Python](https://docs.python.org/3/using/index.html) (versions 3.7 to 3.11) |
| 30 | +- [pip](https://pip.pypa.io/en/stable/installation/) |
| 31 | + |
| 32 | +Then install the LocalStack CLI: |
| 33 | + |
| 34 | +```bash |
| 35 | +python3 -m pip install --upgrade localstack |
| 36 | +```` |
| 37 | + |
| 38 | +:::note |
| 39 | +To download a specific version of LocalStack, replace `<version>` with the required version from [release page](https://github.com/localstack/localstack/releases). |
| 40 | + |
| 41 | +```bash |
| 42 | +python3 -m pip install localstack==<version> |
| 43 | +``` |
| 44 | +::: |
| 45 | + |
| 46 | + |
| 47 | +:::tip[MacOS Sierra?] |
| 48 | +If you have problems with permissions in MacOS X Sierra, install with: |
| 49 | + |
| 50 | +```bash |
| 51 | +python3 -m pip install --user localstack |
| 52 | +``` |
| 53 | +::: |
| 54 | + |
| 55 | +:::danger |
| 56 | +Do not use `sudo` or the `root` user when starting LocalStack. |
| 57 | +It should be installed and started entirely under a local non-root user. |
| 58 | +::: |
| 59 | + |
| 60 | +</TabItem> |
| 61 | + |
| 62 | +<TabItem label="macOS" value="macos"> |
| 63 | + |
| 64 | +You can install the LocalStack CLI using Homebrew: |
| 65 | + |
| 66 | +```bash |
| 67 | +brew install localstack/tap/localstack-cli |
| 68 | +``` |
| 69 | + |
| 70 | +<details> |
| 71 | +<summary>Alternative: Binary Download</summary> |
| 72 | + |
| 73 | +Download the binary for your architecture: |
| 74 | + |
| 75 | +<LinkButton href={`https://github.com/localstack/localstack-cli/releases/download/v${LOCALSTACK_VERSION}/localstack-cli-${LOCALSTACK_VERSION}-darwin-amd64-onefile.tar.gz`} icon="download" variant="minimal">Intel (AMD64)</LinkButton> |
| 76 | + |
| 77 | +Then extract it: |
| 78 | + |
| 79 | +<Code code={`sudo tar xvzf localstack-cli-${LOCALSTACK_VERSION}-darwin-*-onefile.tar.gz -C /usr/local/bin`} lang="bash" /> |
| 80 | + |
| 81 | +</details> |
| 82 | + |
| 83 | +</TabItem> |
| 84 | + |
| 85 | +<TabItem label="Windows" value="windows"> |
| 86 | + |
| 87 | +You can download the pre-built binary below: |
| 88 | + |
| 89 | +<LinkButton href={`https://github.com/localstack/localstack-cli/releases/download/v${LOCALSTACK_VERSION}/localstack-cli-${LOCALSTACK_VERSION}-windows-amd64-onefile.zip`} icon="download" variant="minimal">Intel (AMD64)</LinkButton> |
| 90 | + |
| 91 | +Then extract the archive and run the binary in PowerShell. |
| 92 | + |
| 93 | +:::note |
| 94 | +You can download and install the Windows executable from our [GitHub Releases](https://github.com/localstack/localstack-cli/releases). |
| 95 | +::: |
| 96 | + |
| 97 | +</TabItem> |
| 98 | + |
| 99 | +</Tabs> |
| 100 | + |
| 101 | + |
| 102 | +Need more options? See our [alternative installation instructions](https://docs.localstack.cloud/snowflake/getting-started/#alternatives). |
| 103 | + |
| 104 | +## Starting the Snowflake Emulator |
| 105 | + |
| 106 | +Once the CLI is installed and your auth token is set, start the Snowflake Emulator with: |
| 107 | + |
| 108 | +```bash |
| 109 | +localstack start --stack snowflake |
| 110 | +``` |
| 111 | + |
| 112 | +This will pull the LocalStack for Snowfalke image and run the Docker image automatically. |
| 113 | + |
| 114 | +:::note |
| 115 | +You may also start the LocalStack container using [Docker Compose](https://docs.localstack.cloud/snowflake/getting-started/#alternatives). |
| 116 | +::: |
| 117 | + |
| 118 | +### Check if the emulator is running |
| 119 | + |
| 120 | +Run the following command: |
| 121 | + |
| 122 | +```bash |
| 123 | +curl -d '{}' snowflake.localhost.localstack.cloud:4566/session |
| 124 | +``` |
| 125 | + |
| 126 | +Expected response: |
| 127 | + |
| 128 | +```json |
| 129 | +{"success": true} |
| 130 | +``` |
| 131 | + |
| 132 | + |
| 133 | +## Updating LocalStack |
| 134 | + |
| 135 | +To keep both the CLI and emulator images up to date, run: |
| 136 | + |
| 137 | +```bash |
| 138 | +localstack update all |
| 139 | +``` |
| 140 | + |
| 141 | +If you only want to update the Snowflake image manually (e.g. to pick up a recent fix), you can run: |
| 142 | + |
| 143 | +```bash |
| 144 | +docker pull localstack/snowflake:latest |
| 145 | +``` |
| 146 | + |
| 147 | + |
| 148 | +## Alternatives |
| 149 | + |
| 150 | +If you prefer Docker Compose, you can start the emulator using the configuration below: |
| 151 | + |
| 152 | +```yaml showLineNumbers |
| 153 | +version: "3.8" |
| 154 | +
|
| 155 | +services: |
| 156 | + localstack: |
| 157 | + container_name: "localstack-snowflake" |
| 158 | + image: localstack/snowflake |
| 159 | + ports: |
| 160 | + - "127.0.0.1:4566:4566" |
| 161 | + - "127.0.0.1:4510-4559:4510-4559" |
| 162 | + - "127.0.0.1:443:443" |
| 163 | + environment: |
| 164 | + - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?} |
| 165 | + volumes: |
| 166 | + - "./volume:/var/lib/localstack" |
| 167 | +``` |
| 168 | + |
| 169 | +Start the container with: |
| 170 | + |
| 171 | +```bash |
| 172 | +docker-compose up |
| 173 | +``` |
| 174 | + |
| 175 | +## Next steps |
| 176 | + |
| 177 | +Now that the Snowflake emulator is installed, you can use it for developing and testing your Snowflake data pipelines. Refer to our [Quickstart](/snowflake/getting-started/quickstart/) guide to get started. |
0 commit comments