Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Duong Van Dinh
    @dinhdva_twitter
    but only use case locally
    when i deploy to s3 then not run
    Stefano Buliani
    @sapessi
    You should be able to use this in Lambda. You need to make sure that the Lambda function is configured to connect to your VPC in order to reach the database instance
    What's the exception?
    Duong Van Dinh
    @dinhdva_twitter
    yes, i already setting VPC and connect successfully
    Stefano Buliani
    @sapessi
    Does it throw an excption?
    Duong Van Dinh
    @dinhdva_twitter
    how to apply Warm start for aws-spring-boot?
    Stefano Buliani
    @sapessi
    You have two options:
    1. Try the micronaut sample from the samples folder - compiles to a native executable with graalvm so cold starts are much faster
    2. Pay for provisioned concurrency: https://aws.amazon.com/about-aws/whats-new/2019/12/aws-lambda-announces-provisioned-concurrency/
    Duong Van Dinh
    @dinhdva_twitter
    @sapessi awesomeeee
    Thank you so much!
    I will try and ask you later
    feinstein
    @feinstein
    @sapessi, does provisioned concurrency also work with a VPC in place? The worst of my cold boots are the VPC allocation
    Stefano Buliani
    @sapessi
    Duong Van Dinh
    @dinhdva_twitter
    i worry, i must switch aws-spring-boot-container to same with sample https://github.com/aws-samples/aws-sam-java-rest
    Stefano Buliani
    @sapessi
    I have not looked at that repo. Follow the samples from the serverless java container one
    Or use the archetypes
    Duong Van Dinh
    @dinhdva_twitter
    Our team does not have enough time or knowledge to use micronaut
    Duong Van Dinh
    @dinhdva_twitter
    what is it about "serverless java container one "?
    sorry because my english
    Stefano Buliani
    @sapessi
    You can use the spring sample from this repo. The micronaut sample still uses spring annotations, micronaut just provides the annotation processors and the runtime behind the scenes.
    Duong Van Dinh
    @dinhdva_twitter
    thank for your support
    i will research more for my problem
    feinstein
    @feinstein
    Lots of nice additions to Lambda, thanks @sapessi!
    Duong Van Dinh
    @dinhdva_twitter
    @sapessi
    https://prnt.sc/q6wlbi
    when i run command: ./sam-local.sh
    then server only same image
    call: curl localhost:3000/pets
    => curl: (7) Failed to connect to localhost port 3000: Connection refused
    jay
    @jayasai470
    @sapessi is there any configuration in java runtime in lambda to pass vm options like -noverify which can significantly increase cold start times in springboot app ?
    jay
    @jayasai470
    @sapessi in client context for custom value can we send an object ? as right now from java sdk I can only see its a simple Map<String, String>. is this a standard ?
    /* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
    
    package com.amazonaws.services.lambda.runtime;
    
    import java.util.Map;
    
    /**
     * 
     * Provides information about client configuration and execution environment.
     *
     */
    public interface ClientContext {
        /**
         * Gets the client information provided by the AWS Mobile SDK
         * 
         */
        public Client getClient();
    
        /**
         * Gets custom values set by the client application
         * <p>
         * This map is mutable (and not thread-safe if mutated)
         * </p>
         */
        public Map<String, String> getCustom();
    
        /**
         * Gets environment information provided by mobile SDK, immutable. 
         * 
         */
        public Map<String, String> getEnvironment();
    
    }
    Stefano Buliani
    @sapessi
    Those context variables are passed as a special parameter when the aws mobile sdk calls lambda directly. They are unlikely to be relevant for you
    Stefano Buliani
    @sapessi
    You cannot pass parameters to the jvm with the default java runtime. You could do it by building a custom runtime
    jay
    @jayasai470
    Thanks for the response
    I am using a nodejs plugin for warming up my function, that plugin passes the json payload to both context and event
    FidelLimited/serverless-plugin-warmup#207
    BTW is there any development going on for this issue ?
    awslabs/aws-serverless-java-container#304
    Stefano Buliani
    @sapessi

    It's on my todo list - it's been there for a while as I keep getting pulled in other directions. I hope to get to it next week.

    As for the nodejs warmup, why not just configure provisioned concurrency?

    jay
    @jayasai470
    I have tried the provisioned concurrency but my springboot app still takes 7sec to start instead of 11sec
    is it supposed to start the springboot app ?
    Stefano Buliani
    @sapessi
    Weird, it shouldn't. Make sure that all of the initialization code is in the constructor of the handler class or as a static block. The handleRequest method should literally be a 1-liner to call proxy
    If you are already doing all those things. You can still make provisioned concurrency work by making a call to handleRequest from your constructor to exercise the whole thing
    jay
    @jayasai470
    yup I was following your suggestions in the github wiki https://github.com/awslabs/aws-serverless-java-container/wiki/Quick-start---Spring-Boot2
    i was using async initialization in static block
    also i was following this guide to improve my startup times in springboot
    https://spring.io/blog/2018/12/12/how-fast-is-spring
    I will give it a try how would I get hold of input output stream and context in the empty constructor ?
    Stefano Buliani
    @sapessi
    You can just generate a test request and send it to the method. Take a look at our unit tests in the springboot implementation, they all do this using a request builder helper class
    jay
    @jayasai470
    oh ok will take a look at it thanks
    jay
    @jayasai470
    @sapessi I have a question regarding springboot async support in aws lamdba, can we use the async processing of springboot when we enable the provisioned concurrency in lambda?
    or its better off doing the async processing in seperate lambda ?
    Raj bekkam
    @Rajabekkam_gitlab
    Hello,
    I would need help regarding Lambda (spring boot - java app) function connection aurora serverless db, I am getting " communication link failure " even for the first request (never connecting). I have verified the VPC, subnets and security groups same as RDS. am I missing something here ? Please help.
    3 replies
    Abhijeet Joshi
    @jabhijeet

    Hello All,

    I am new to using this library

    spring doc says

    https://docs.spring.io/spring-boot/docs/2.0.x/reference/html/using-boot-using-springbootapplication-annotation.html

    @SpringBootApplication annotation can be used to enable those three features, that is:

    @EnableAutoConfiguration: enable Spring Boot’s auto-configuration mechanism
    @ComponentScan: enable @Component scan on the package where the application is located (see the best practices)
    @Configuration: allow to register extra beans in the context or import additional configuration classes

    Still why we need to explicitly import the controller class?

    5 replies
    Component scan is implicitly enabled
    Max Aller
    @nanodeath_gitlab
    I'm trying to validate that my PR is going to work...how do I do that? there's no documentation on how to build this package. I tried mvn test but this fails even with origin/master.
    11 replies
    Max Aller
    @nanodeath_gitlab

    okay, PR aside, I'd like to see if the thing I'm fixing even makes sense. I'm trying to deploy a "hello world" Micronaut application to Lambda and hit it via API Gateway. However, the request looks like this:

    {
        "body": "{}",
        "requestContext": {
            "apiId": "dgsgshsh",
            "requestId": "abcdefg",
            "accountId": "12345678",
            "stage": "$default",
            "requestTimeEpoch": 0
        },
        "isBase64Encoded": false,
        "requestSource": "API_GATEWAY"
    }

    which triggers a NPE here because getIdentity() returns null. so...I should add a null-check for getIdentity(), right? or is something else horribly wrong

    11 replies
    Stefano Buliani
    @sapessi
    I would explore provisioned concurrency - it's a feature of lambda