GithubHelp home page GithubHelp logo

support packaged CodeUri about aws-sam-cli HOT 4 CLOSED

joekiller avatar joekiller commented on September 24, 2024
support packaged CodeUri

from aws-sam-cli.

Comments (4)

PaulMaddox avatar PaulMaddox commented on September 24, 2024 5

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.

cjsauer avatar cjsauer commented on September 24, 2024 1

Looking forward to this feature as well!

from aws-sam-cli.

sanathkr avatar sanathkr commented on September 24, 2024

Agreed, this is a very common use case and we should support it.

from aws-sam-cli.

PaulMaddox avatar PaulMaddox commented on September 24, 2024

Working on this at the moment.
Should be done later today if all goes well.

from aws-sam-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.