Comments (4)
This is now implemented by pull request #75 (automatic unzipping of packaged archives such as JAR/ZIP).
With the new version:
Resources:
PetStoreFunction:
Type: AWS::Serverless::Function
Properties:
Handler: com.amazonaws.serverless.sample.jersey.LambdaHandler::handleRequest
Runtime: java8
CodeUri: target/serverless-jersey-example-1.0-SNAPSHOT.jar
... snip ...
$ git clone https://github.com/awslabs/aws-serverless-java-container
$ cd aws-serverless-java-container/samples/jersey/pet-store
$ mvn package
$ sam local start-api -t sam.yaml
2017/08/18 15:25:00 Connected to Docker 1.30
2017/08/18 15:25:00 Successfully parsed sam.yaml (version 2010-09-09)
2017/08/18 15:25:00 Fetching lambci/lambda:java8 image for java8 runtime...
java8: Pulling from lambci/lambda
Digest: sha256:668979530863a155b52533947e782fe164908eda2d6c5741317511bfa036d8cf
Status: Image is up to date for lambci/lambda:java8
Mounting com.amazonaws.serverless.sample.jersey.LambdaHandler::handleRequest (java8) at http://127.0.0.1:3000/{proxy+} [OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT]
You can now browse to the above endpoints to invoke your functions.
You do not need to restart/reload SAM CLI while working on your functions,
changes will be reflected instantly/automatically. You only need to restart
SAM CLI if you update your AWS SAM template.
2017/08/18 15:26:17 Invoking com.amazonaws.serverless.sample.jersey.LambdaHandler::handleRequest (java8)
2017/08/18 15:26:17 Decompressing serverless-jersey-example-1.0-SNAPSHOT.jar into runtime container...
log4j:WARN No appenders could be found for logger (com.amazonaws.serverless.proxy.internal.LambdaContainerHandler).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
START RequestId: 0aee9bbe-79d0-480a-8efb-9dfd35ca68b8 Version: $LATEST
END RequestId: 0aee9bbe-79d0-480a-8efb-9dfd35ca68b8
REPORT RequestId: 0aee9bbe-79d0-480a-8efb-9dfd35ca68b8 Duration: 454.63 ms Billed Duration: 500 ms Memory Size: 512 MB Max Memory Used: 13 MB
and the HTTP response from http://localhost:3000/pets
[{"id":"d2d77c29-4426-4c1c-9445-15367993db21","breed":"Jack Russell Terrier","name":"Teddy","dateOfBirth":1448375182603},{"id":"918c5a08-abb2-43fc-a9e5-40ab4a9f538d","breed":"Beagle","name":"Max","dateOfBirth":1304605582603},{"id":"4416e7df-40e0-4695-b622-4c64336a55eb","breed":"Afghan Hound","name":"Bear","dateOfBirth":1196778382604},{"id":"046f0a53-e851-4105-b024-411cead3d2a7","breed":"Beagle","name":"Jack\t","dateOfBirth":1011450382604},{"id":"9078d215-7bcc-4534-9e2a-d3aaf6a45ef6","breed":"Dalmatian","name":"Bella","dateOfBirth":1309098382604},{"id":"9911779b-398f-4f6a-b4ae-da3b531d3e0d","breed":"Jack Russell Terrier","name":"Maggie","dateOfBirth":1093184782604},{"id":"a6838c72-aabc-45bf-93cd-b08157493c22","breed":"Bloodhound","name":"Ginger","dateOfBirth":1331130382604},{"id":"a420d1cc-ba29-4731-87a8-64a0a3fc9eaa","breed":"Beagle","name":"Princess","dateOfBirth":1035901582604},{"id":"5decb878-15b4-4c01-8bcf-33bde8bbbcf7","breed":"Dalmatian","name":"Roxy","dateOfBirth":1122301582604},{"id":"22a64d5f-e20c-42f8-9745-2357ded83add","breed":"Afghan Hound","name":"Lola","dateOfBirth":1202135182604}]
This will be included in our next release. I don't have an exact date right now, but it won't be long.
from aws-sam-cli.
Looking forward to this feature as well!
from aws-sam-cli.
Agreed, this is a very common use case and we should support it.
from aws-sam-cli.
Working on this at the moment.
Should be done later today if all goes well.
from aws-sam-cli.
Related Issues (20)
- Bug: sam validate fails for template using 1.122.0 or 1.223.0 HOT 4
- Feature request: Prune Old Versions HOT 2
- Bug: `sam build` Ignores Files in dist/ Directory When Specified in .gitignore HOT 2
- Bug: DBProxyTargetGroup Creation is very slow when using SAM deploy HOT 3
- Bug: sam build - JSONDecodeError HOT 1
- Bug: `sam init` error: "could not clone repo" (non-zero exit status 128) HOT 10
- Bug: parsing Ref in template.json is incorrect HOT 3
- Bug: sam validate - UnexpectedRuleException HOT 5
- Bug: Numpy In Lambda Layer HOT 3
- Bug: sam pipeline bootstrap --oidc-provider gitlab with a custom gitlab url creates an identity provider with excessive `/` suffix HOT 4
- Bug: Serverless Api: Incorrect handling of !If statement HOT 3
- Feature request: Resolve AWS::Include transform intrinsic for DefinitionBody in validate HOT 2
- Bug: sam local invoke - InvalidParameterValueException HOT 1
- Bug: sam build can't check the JVM version on gradle >= v8.9 HOT 2
- Bug: Sam build hanging in github-actions HOT 3
- Feature request: Add `dotnet` BuildMethod in addition to `dotnet7` HOT 3
- Binary execution issues in SAM CLI container due to read-only file system HOT 3
- Bug: sam deploy started failing HOT 2
- --debug-port not working in SAM Local Invoke on Windows HOT 2
- SAM Build Not Mounting Lambda Code in `/var/task` During `sam local start api` on Windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sam-cli.