Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ When active, rules are evaluated sequentially on every request to LocalStack unt

The schema for the configuration is as follows.

```json
```json showshowLineNumbers
[
{
"region": "(str) Region name, e.g. 'ap-south-1'. If omitted, all regions are affected.",
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/aws/capabilities/config/podman.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ podman machine set --rootful
For the Docker Compose setup, use the following configuration.
When running in rootless mode, ensure to comment out the HTTPS gateway port, as it is unable to bind to privileged ports below 1024.

```yaml
```yaml showshowLineNumbers
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ docker run --rm -it --dns 172.27.0.2 --network ls <arguments> <image name>
```
</TabItem>
<TabItem label="docker-compose.yml">
```yaml
```yaml showshowLineNumbers
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
Expand Down Expand Up @@ -200,7 +200,7 @@ docker run --rm it --network my-network <image name>
```
</TabItem>
<TabItem label="docker-compose.yml">
```yaml
```yaml showshowLineNumbers
services:
localstack:
# other configuration here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ GATEWAY_LISTEN=0.0.0.0:4766 EXTERNAL_SERVICE_PORTS_START=4710 EXTERNAL_SERVICE_P
```
</TabItem>
<TabItem label="docker-compose">
```yaml
```yaml showshowLineNumbers
services:
localstack-main-1:
container_name: localstack-main-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ If you run LocalStack in a docker container (which includes using [the CLI](/aws

Create a `Dockerfile` containing the following commands:

```yaml
```yaml showshowLineNumbers
FROM localstack/localstack:latest
# or if using the pro image:
FROM localstack/localstack-pro:latest
Expand Down Expand Up @@ -74,7 +74,7 @@ docker run <docker arguments> <image name>
```
</TabItem>
<TabItem label="docker-compose.yml">
```yaml
```yaml showshowLineNumbers
services:
localstack:
image: <image name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ However we have not included the `iam:PassRole` permission, and we will use the

Create a policy document named `policy_1.json` and add the following content:

```json
```json showshowLineNumbers
{
"Version": "2012-10-17",
"Statement": [
Expand Down Expand Up @@ -113,7 +113,7 @@ You can incorporate this action into the policy.
For illustrative purposes, we will keep the example straightforward, using the same wildcard resource.
Edit the `policy_1.json` file to include the `iam:PassRole` action:

```json
```json showshowLineNumbers
{
"Version": "2012-10-17",
"Statement": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ awslocal sns create-topic --name test-topic
In the other tab, the required policy will be generated.
This policy can then be attached to an IAM role, enabling it to create the resource.

```bash
```bash showshowLineNumbers
Attached to identity: "arn:aws:iam::000000000000:root"

Policy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ AUTO_LOAD_POD=foo-pod localstack start
```
</TabItem>
<TabItem label="Docker Compose">
```yaml
```yaml showshowLineNumbers
services:
localstack:
container_name: "localstack-main"
Expand Down Expand Up @@ -352,7 +352,7 @@ LocalStack, upon mounting `init-pods.d` to the appropriate location, will sequen

The docker compose file for correctly mounting `init-pods.d` will look like:

```yaml
```yaml showshowLineNumbers
services:
localstack:
container_name: "localstack-main"
Expand Down Expand Up @@ -498,7 +498,7 @@ With such a configuration, the `foo-pod` Cloud Pod will be loaded from the `bar-
To properly configure the remote, you need to provide the needed environment variables when starting the LocalStack container.
For instance, a S3 remote needs a `AWS_ACCESS_KEY` and a `AWS_SECRET_ACCESS_KEY`, as follows:

```yaml
```yaml showshowLineNumbers
services:
localstack:
container_name: "localstack-main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PERSISTENCE=1 localstack start
```
</TabItem>
<TabItem label="Docker Compose">
```yaml
```yaml showshowLineNumbers
image: localstack/localstack-pro
environment:
- LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?}
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/aws/enterprise/k8s-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ kubectl apply -f https://raw.githubusercontent.com/localstack/localstack-k8s-ope

You can then deploy a LocalStack instance by storing the following file content as `localstack.yml` and applying it against the cluster via `kubectl apply -f localstack.yml`.

```bash
```bash showshowLineNumbers
apiVersion: api.localstack.cloud/v1alpha1
kind: LocalStack
metadata:
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/aws/getting-started/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ To do so, you need to change the [`docker-compose.yml`](https://github.com/local
<Tabs>
<TabItem label="WSL Linux File System">

```yaml
```yaml showshowLineNumbers
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "\\\\wsl$\\<Ubuntu>\\home\\<USERNAME>\\volume:/var/lib/localstack" # mount volume in WSL2 Linux file system
Expand All @@ -246,7 +246,7 @@ To do so, you need to change the [`docker-compose.yml`](https://github.com/local
As an alternative, you can set the volume as `- "~/volume:/var/lib/localstack"` then start Docker using command `wsl docker compose -f docker-compose.yml up`.
</TabItem>
<TabItem label="Docker Volumes">
```yaml
```yaml showshowLineNumbers
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "localstack_data:/var/lib/localstack" # mount Docker volume
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/aws/getting-started/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Docker Compose v1.9.0 and above is supported.
<Tabs>

<TabItem label="Community">
```yaml
```yaml showshowLineNumbers
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
Expand All @@ -264,7 +264,7 @@ services:
</TabItem>

<TabItem label="Pro" >
```yaml
```yaml showshowLineNumbers
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
Expand Down
12 changes: 6 additions & 6 deletions src/content/docs/aws/getting-started/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ awslocal sns subscribe \

#### Create the Presign Lambda

```bash
```bash showshowLineNumbers
(cd lambdas/presign; rm -f lambda.zip; zip lambda.zip handler.py)
awslocal lambda create-function \
--function-name presign \
Expand All @@ -187,7 +187,7 @@ $ awslocal lambda create-function-url-config \

#### Create the Image List Lambda

```bash
```bash showshowLineNumbers
(cd lambdas/list; rm -f lambda.zip; zip lambda.zip handler.py)
awslocal lambda create-function \
--function-name list \
Expand All @@ -207,7 +207,7 @@ $ awslocal lambda create-function-url-config \

<Tabs>
<TabItem label="macOS">
```bash
```bash showshowLineNumbers
cd lambdas/resize
rm -rf libs lambda.zip
docker run --platform linux/x86_64 -v "$PWD":/var/task "public.ecr.aws/sam/build-python3.11" /bin/sh -c "pip install -r requirements.txt -t libs; exit"
Expand All @@ -218,7 +218,7 @@ $ awslocal lambda create-function-url-config \
```
</TabItem>
<TabItem label="Linux">
```bash
```bash showshowLineNumbers
cd lambdas/resize
rm -rf package lambda.zip
mkdir package
Expand All @@ -230,7 +230,7 @@ $ awslocal lambda create-function-url-config \
```
</TabItem>
<TabItem label="Windows">
```bash
```bash showshowLineNumbers
cd lambdas/resize
rm -rf package lambda.zip
mkdir package
Expand All @@ -245,7 +245,7 @@ $ awslocal lambda create-function-url-config \

#### Create the Image Resizer Lambda

```bash
```bash showshowLineNumbers
awslocal lambda create-function \
--function-name resize \
--runtime python3.11 \
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/aws/integrations/app-frameworks/quarkus.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The Lambda extension is based on [AWS Java SDK 2.x](https://docs.aws.amazon.com/

Create a new project with the following command:

```bash
```bash showshowLineNumbers
mvn io.quarkus.platform:quarkus-maven-plugin:3.6.3:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=amazon-lambda-quickstart \
Expand Down Expand Up @@ -72,7 +72,7 @@ Add the following dependencies to the `pom.xml` file:

To configure LocalStack, add the following properties to the `application.properties` file:

```bash
```bash showshowLineNumbers
quarkus.lambda.endpoint-override=http://localhost:4566

quarkus.lambda.aws.region=us-east-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This guide assumes that you have the following tools installed.
It also assumes that you already have a Serverless app set up consisting of a couple of Lambda functions and a `serverless.yml` file similar to the following.
An example Serverless app integrated with LocalStack can be found here: <a href="https://github.com/localstack/serverless-python-rest-api-with-dynamodb"><i class="fab fa-github"></i> Simple REST API using the Serverless Framework and LocalStack</a>

```yaml
```yaml showshowLineNumbers
service: my-service

frameworkVersion: ">=1.1.0 <=2.50.0"
Expand Down Expand Up @@ -115,7 +115,7 @@ Hence, you need to configure the Lambda functions to use the `AWS_ENDPOINT_URL`
In Python, this may look something like.
The code detects if it is running in LocalStack by checking if the `AWS_ENDPOINT_URL` variable exists and then configures the endpoint URL accordingly.

```python
```python showshowLineNumbers
...
if 'AWS_ENDPOINT_URL' in os.environ:
dynamodb = boto3.resource('dynamodb', endpoint_url=os.environ['AWS_ENDPOINT_URL'])
Expand Down Expand Up @@ -182,7 +182,7 @@ Use the displayed endpoint `http://localhost:4566/restapis/XXXXXXXXXX/local/_use

serverless-localstack supports a feature for lambda functions that allows local code mounting:

```yaml
```yaml showshowLineNumbers
# serverless.yml

custom:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ To that end, we use the "Shadow Jar" plugin.

Here's our final `build.gradle`:

```groovy showLineNumbers=true title="build.gradle"
```groovy showshowLineNumbers=true title="build.gradle"
plugins {
id "java"
id "org.jetbrains.kotlin.jvm" version '1.5.31'
Expand Down Expand Up @@ -210,7 +210,7 @@ In this project, we are following
[official documentation](https://docs.aws.amazon.com/lambda/latest/dg/java-logging.html#java-wt-logging-using-log4j2.8)
to setup up `src/main/resources/log4j2.xml` content.

```xml title="log4j2.xml"
```xml title="log4j2.xml" showshowLineNumbers
?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="com.amazonaws.services.lambda.runtime.log4j2.LambdaAppender">
<Appenders>
Expand Down Expand Up @@ -255,7 +255,7 @@ org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest
Now our application needs an entry-class, the one we referenced earlier.
Let's add it under `src/main/kotlin/org/localstack/sampleproject/Application.kt`.

```kotlin showLineNumbers
```kotlin showshowLineNumbers
package org.localstack.sampleproject

import org.springframework.boot.autoconfigure.SpringBootApplication
Expand All @@ -276,7 +276,7 @@ Let's configure it by creating a new configuration class `JacksonConfiguration.k
`src/main/kotlin/org/localstack/sampleproject/config`:


```kotlin title="JacksonConfiguration.kt"
```kotlin title="JacksonConfiguration.kt" showshowLineNumbers
package org.localstack.sampleproject.config

import com.fasterxml.jackson.annotation.JsonInclude
Expand Down Expand Up @@ -319,7 +319,7 @@ implementations.

Let's create a small logging utility to simplify interactions with the logger

```kotlin title="Logger.kt"
```kotlin title="Logger.kt" showshowLineNumbers
package org.localstack.sampleproject.util

import org.apache.logging.log4j.LogManager
Expand All @@ -343,7 +343,7 @@ Your application may even support multiple protocols with different request/resp

Let's define utility functions to to build API gateway responses:

```kotlin showLineNumbers
```kotlin showshowLineNumbers
package org.localstack.sampleproject.util

import org.springframework.messaging.Message
Expand All @@ -369,7 +369,7 @@ fun buildJsonErrorResponse(message: String, code: Int = 500) =

And now a utility function to process API Gateway requests:

```kotlin showLineNumbers
```kotlin showshowLineNumbers
package org.localstack.sampleproject.util

import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent
Expand Down Expand Up @@ -401,7 +401,7 @@ To transfer data from requests into something more meaningful than JSON strings
(and back) you will be using a lot of Models and Data Transfer Objects (DTOs).
It's time to define our first one.

```kotlin showLineNumbers title="SampleModel.kt"
```kotlin showshowLineNumbers title="SampleModel.kt"
package org.localstack.sampleproject.model

import com.fasterxml.jackson.annotation.JsonIgnore
Expand All @@ -420,7 +420,7 @@ data class SampleModel(
Let's add our first endpoints to simulate CRUD operations on previously
defined `SampleModel`:

```kotlin showLineNumbers title="SampleApi.kt"
```kotlin showshowLineNumbers title="SampleApi.kt"
package org.localstack.sampleproject.api

import com.fasterxml.jackson.databind.ObjectMapper
Expand Down Expand Up @@ -473,7 +473,7 @@ We know Java's cold start is always a pain.
To minimize this pain, we will try to define a pre-warming endpoint within the Rest API.
By invoking this function every 5-10 mins we can make sure Rest API lambda is always kept in a pre-warmed state.

```kotlin showLineNumbers title="ScheduleApi.kt"
```kotlin showshowLineNumbers title="ScheduleApi.kt"
package org.localstack.sampleproject.api

import com.fasterxml.jackson.databind.ObjectMapper
Expand Down Expand Up @@ -515,7 +515,7 @@ We can still define pure lambda functions, DynamoDB stream handlers, and so on.

Below you can find a little example of few lambda functions grouped in `LambdaApi` class.

```kotlin showLineNumbers title="LambdaApi.kt"
```kotlin showshowLineNumbers title="LambdaApi.kt"
package org.localstack.sampleproject.api

import com.amazonaws.services.lambda.runtime.events.DynamodbEvent
Expand Down Expand Up @@ -575,7 +575,7 @@ for usage examples.

<Tabs>
<TabItem label="Serverless">
```yaml
```yaml showshowLineNumbers
service: localstack-sampleproject-serverless

provider:
Expand Down Expand Up @@ -628,7 +628,7 @@ functions:
```
</TabItem>
<TabItem label="AWS CDK">
```java title="ApplicationStack.kt"
```java title="ApplicationStack.kt" showshowLineNumbers
package org.localstack.cdkstack

import java.util.UUID
Expand Down Expand Up @@ -703,7 +703,7 @@ class ApplicationStack(parent: Construct, name: String) : Stack(parent, name) {
```
</TabItem>
<TabItem label="Terraform">
```hcl title="variables.tf"
```hcl title="variables.tf" showshowLineNumbers
variable "STAGE" {
type = string
default = "local"
Expand Down
Loading