Description
Type of request: This is a ...
[ ] bug report
Detailed description
Trying to trigger an event from S3 to SNS which is connected to lambda. (Once SNS receives an event from S3, lambda should trigger)
...
Expected behavior
After uploading a file on S3, an event should be received by SNS topic and Lambda should trigger
...
Actual behavior
Lambda isn't triggering and getting an exception/failure
...
Steps to reproduce
docker-compose up -d
-
Create Bucket->
aws --endpoint-url=http://localhost:4566 s3 mb s3://test-bucket-sns -
Create Topic->
aws sns create-topic --name putnotifications --endpoint-url=http://localhost:4575 -
Subscribe to the topic-> (NOT NECESSARY)
aws --endpoint-url=http://localhost:4575 sns subscribe --topic-arn arn:aws:sns:us-east-1:000000000000:putnotifications --protocol email --notification-endpoint [email protected] -
PUT Notification->
aws s3api put-bucket-notification-configuration --bucket test-bucket-sns --notification-configuration file://snsTopicConfiguration.json --endpoint-url=http://localhost:4566 -
Create Function->
aws lambda create-function --endpoint-url=http://localhost:4574 --function-name SQSdemo --runtime java11 --handler com.aws.lamda.SQSdemo --zip-file fileb://C:/AWS/Localstack/aws-lambda-example/target/aws-labmda-example-1.0-SNAPSHOT.jar --role arn:aws:iam::1234567:role/anything --environment Variables="{PROFILE=LOCAL,AWS_REGION=us-east-1}" -
Subscribe lambda to Topic:
aws sns subscribe --topic-arn arn:aws:sns:us-east-1:000000000000:putnotifications --protocol lambda --notification-endpoint arn:aws:lambda:us-east-1:000000000000:function:SQSdemo --endpoint-url=http://localhost:4575 -
upload a file in s3:
aws s3 cp s3-event.json s3://test-bucket-sns --endpoint-url=http://localhost:4566
snsTopicConfiguration.json -
{
"TopicConfigurations": [
{
"TopicArn": "arn:aws:sns:us-east-1:000000000000:putnotifications",
"Events": [
"s3:ObjectCreated:*"
]
}
]
}
Docker file:
version: '2.1'
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main111}"
image: localstack/localstack:latest
ports:
- "4566-4599:4566-4599"
- "${PORT_WEB_UI-8081}:${PORT_WEB_UI-8080}"
environment:
- SERVICES=${SERVICES- }
##- DEBUG=${DEBUG- }
- DEBUG=1
- DATA_DIR=${DATA_DIR- }
- PORT_WEB_UI=${PORT_WEB_UI- }
- LAMBDA_EXECUTOR=docker
- KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
- DOCKER_HOST=unix:///var/run/docker.sock
- LAMBDA_DOCKER_NETWORK=aws-lambda-example_default
- HOST_TMP_FOLDER=${TMPDIR}
volumes:
- "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"