Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AWS SAM - VS Code configuration #657

Closed
MarcelStranak opened this issue Jun 9, 2023 · 0 comments · Fixed by #1234
Closed

Update AWS SAM - VS Code configuration #657

MarcelStranak opened this issue Jun 9, 2023 · 0 comments · Fixed by #1234

Comments

@MarcelStranak
Copy link
Contributor

Add a point about the needed configuration for AWS SAM in VS Code, launch.json.

It is important to mention the dockerNetwork property, which initiates the LocalStack container to execute the SAM local invoke command in the same network as the LocalStack container.
See https://docs.aws.amazon.com/cloud9/latest/user-guide/sam-debug-config-ref.html.

Example:

{
            "type": "aws-sam",
            "request": "direct-invoke",
            "name": "Job dispatcher lambda",
            "invokeTarget": {
                "target": "code",
                "projectRoot": "${workspaceFolder}",
                "lambdaHandler": "lambda/lambda.handler"
            },
            "lambda": {
                "runtime": "python3.8",
                "payload": {},
                "environmentVariables": {
                    "ENDPOINT_URL": "http://localstack:4566/",
                    "S3_ENDPOINT_URL": "http://s3.localhost.localstack.cloud:4566/",
                    "AWS_ACCESS_KEY_ID": "test",
                    "AWS_SECRET_ACCESS_KEY": "test",
                    "AWS_SESSION_TOKEN": "test",
                    "AWS_REGION": "us-east-1",
                    "MAIN_DOCKER_NETWORK": "localstack-network"
                }
            },
            "sam": {
                "dockerNetwork": "localstack-network"
            }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant