0

I created a small service using serveless framework by following this guide https://serverless.com/blog/how-to-create-a-rest-api-in-java-using-dynamodb-and-serverless/. I'm using "AWS Lambda", "APIGateway" and "DynamoDB". I want to be able to deploy my service to a docker container so I can test my api and dynamodb locally. I want to be able to send curl commands to my localhost and be able to see the response. How do I go about doing this? Are there any tutorials or step by step guide?

3
  • For the DynamoDB part, you can use the DynamoDB local Docker image from Docker hub. hub.docker.com/r/amazon/dynamodb-local This is a test/dev version for exactly the kinds of things you are doing. Commented Feb 10, 2019 at 13:44
  • I suggest that you use AWS Cloud9 which is a cloud IDE for writing, running and debugging code. You could run the lambda function as local environment. Here is their website: aws.amazon.com/cloud9 Commented Feb 11, 2019 at 9:49
  • BTW, it has no sense to use both Lambda and Docker. Commented Feb 11, 2019 at 9:52

2 Answers 2

3

I don't understand your purpose. The whole purpose of Serverless is to "not manage servers". Why would you do that then? Rather create a separate test environment on AWS itself to test the Serverless. API gateways, Lambda and DynamoDB are all AWS specific services. You are making your task more complex than easier by thinking of creating a clone of DynamoDB, Lambda, API gateway inside docker. You really have to work a lot on creating similar integration as of API Gateway-> Lambda integration even if you use MongoDB or Cassandra in place of DynamoDB. (Even if you just take such scalability in picture). If you rather want to learn creating such web services in docker then you may use something like mongo db docker image(Directly from docker hub) in place of DynamoDB

Update: You can use https://hub.docker.com/r/amazon/dynamodb-local/ for DynamoDB though. First image push was six months back.

For Lambda you can try https://github.com/lambci/docker-lambda and see if it works.

Sign up to request clarification or add additional context in comments.

4 Comments

Why not just use the DynamoDB local from docker hub? hub.docker.com/r/amazon/dynamodb-local
Ya makes sense. I was not aware of it as first release was 6 months back only. Edited answer
thanks @Kirk if I use dynamodb local from docker hub then that is just the dynamodb taken care of but I'm still struggling to see how do I test my RESTAPI? WIll I be able to deploy my Lambda to docker container too?
You can try github.com/lambci/docker-lambda for docker but original suggestion remain same. Updated answer accordingly.
0

Use Sam local for the lambda piece and DynamoDB local for the DynamoDB piece.

Also, once in AWS you might be able to get away without api gateway by hook up ELBs to Lambda functions.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.