I have created from serverless project from aws-python-http-api template
My serverless.yml file looks like below
service: aws-http-api
frameworkVersion: '3'
plugins:
- serverless-localstack
provider:
name: aws
stage: local
runtime: python3.9
profile: localstack
functions:
hello:
handler: handler.hello
events:
- httpApi:
path: /
method: get
custom:
localstack:
stages:
- local
host: http://localhost
edgePort: 4566
autostart: true
lambda:
# Enable this flag to improve performance
mountCode: True
docker:
# Enable this flag to run "docker ..." commands as sudo
sudo: False
stages:
local:
...
I am running localstack with docker-compose and docker-compose.yml looks like
version: '3.0'
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_latest}"
image: localstack/localstack:latest
environment:
- AWS_DEFAULT_REGION=us-east-1
- EDGE_PORT=4566
- DEBUG=${DEBUG-}
- LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-}
- DOCKER_HOST=unix:///var/run/docker.sock
- HOSTNAME=localhost
- SERVICES=${SERVICES-serverless
,acm,apigateway,cloudformation,cloudwatch
,dynamodb,dynamodbstreams,ec2,es,events
,firehose,iam,kinesis,kms,lambda,rds
,route53,s3,s3api,secretsmanager,ses,sns
,sqs,ssm,stepfunctions,sts}
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
docker-compose up -d worked properly and I can see results properly on http://127.0.0.1:4566/health
I have move into project folder after all and runned following command serverless deploy and error is
UPDATE_FAILED: aws-http-api-local (AWS::CloudFormation::Stack)
undefined
I have also runned next one ** serverless deploy --stage local** and same error. Any idea why it can happen ?
docker-compose up -d worked properly and I can see results properly on http://127.0.0.1:4566/health
I have move into project folder after all and runned following command serverless deploy and error is
UPDATE_FAILED: aws-http-api-local (AWS::CloudFormation::Stack)
undefined
I have also runned next one ** serverless deploy --stage local** and same error. Any idea why it can happen ?
Hi — To run the above Serverless example, you will need access to LocalStack Pro, since the Community version doesn't support some of the AWS APIs being called during the operation.
You would need to update the
docker-compose.yml
to the following configuration:You will also need to update the
serverless.yml
to the following configuration:It would involve installing the
serverless-localstack
plugin as well. On a successful setup, you can runserverless deploy --stage local
, and it would yield the following output: