Created
May 23, 2020 07:18
-
-
Save sabuhish/655894a6a19163d44569d94275ac9df1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -p 4574:4574 -p 4576:4576 --name my_localstack localstack/localstack | |
################################SQS############################################### | |
#to created test_queue: | |
aws --endpoint-url=http://localhost:4576 sqs create-queue --queue-name SQSTest | |
#send message to queue | |
aws --endpoint-url=http://localhost:4576 sqs send-message --queue-url http://localhost:4576/123456789012/SQSTest --message-body 'Test baby!' | |
#to receive message from tets queue | |
aws --endpoint-url=http://localhost:4576 sqs receive-message --queue-url http://localhost:4576/123456789012/SQSTest | |
#to list all queues: | |
aws --endpoint-url=http://localhost:4576 sqs list-queues | |
#to delete mesages in test_queue | |
aws --endpoint-url=http://localhost:4576 sqs delete-message --queue-url http://localhost:4576/123456789012/SQSTest --receipt-handle id_of_reviec_handle | |
# get the true event-source-arn with | |
aws sqs get-queue-attributes --queue-url http://localhost:4576/queue/SQSTest --attribute-name QueueArn --endpoint-url http://localhost:4576 | |
------------------------------------------------------------------------- | |
########################################Lambda################################################## | |
#lambda create function | |
aws --endpoint-url=http://localhost:4574 lambda create-function --runtime python3.7 --role test --handler lambda.lambda_handler --function-name SQSTest --zip-file fileb:////home/sebuhi/Desktop/function.zip | |
#update lambda | |
sudo zip -g function.zip lambda.py | |
aws --endpoint-url=http://localhost:4574 lambda update-function-code --function-name SQSTest --zip-file fileb:///home/sebuhi/Desktop/function.zip | |
# lambda list functions | |
aws lambda list-functions --endpoint-url=http://localhost:4574 | |
#delete function name | |
aws lambda --endpoint-url=http://localhost:4574 delete-function --function-name SQSTest | |
#lambda create-event-source-mapping | |
aws --endpoint-url=http://localhost:4574 lambda create-event-source-mapping --function-name SQSTest --event-source-arn arn:aws:sqs:us-east-1:000000000000:SQSTest | |
#to get lambda event source mappings: | |
aws --endpoint-url=http://localhost:4574 lambda list-event-source-mappings | |
#to delete evetn source mappings: | |
aws lambda --endpoint-url=http://localhost:4574 delete-event-source-mapping --uuid the_id | |
aws --endpoint-url=http://localhost:4574 lambda invoke --function-name arn:aws:lambda:us-east-1:000000000000:function:SQSTest outfile.json | |
aws --endpoint-url=http://localhost:4574 lambda invoke --function-name arn:aws:lambda:us-east-1:000000000000:function:SQSTest out --log-type Tail | |
aws --endpoint-url=http://localhost:4574 lambda update-function-code --function-name function --zip-file fileb://function.zip | |
zip function.zip lambda.py | |
pip install --target ./package requests | |
cd to packge | |
zip -r9 ../function.zip . | |
zip -g function.zip lambda.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment