将无服务器应用程序部署到Docker

时间:2019-02-10 12:53:57

标签: amazon-web-services docker amazon-dynamodb serverless-framework serverless

我按照本指南https://serverless.com/blog/how-to-create-a-rest-api-in-java-using-dynamodb-and-serverless/使用无服务框架创建了一个小型服务。我正在使用“ AWS Lambda”,“ APIGateway”和“ DynamoDB”。我希望能够将服务部署到Docker容器,以便可以在本地测试api和dynamodb。我希望能够将curl命令发送到我的本地主机并能够看到响应。我该怎么做呢?是否有任何教程或分步指南?

2 个答案:

答案 0 :(得分: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/的值。第一次推送图片已经六个月了。

对于Lambda,您可以尝试https://github.com/lambci/docker-lambda并查看它是否有效。

答案 1 :(得分:0)

Sam local用于lambda,将DynamoDB local用于DynamoDB。

此外,一旦进入AWS,您可能无需hook up ELBs to Lambda functions就无需使用api网关。

相关问题