A v
A v

Reputation: 13

Want to call AWS lambda in VPC to another AWS lambda without VPC in same region and account using JAVA 8

Want to connect one AWS lambda which is in VPC to another lambda which is not in VPC but in same region and account.


AWS java sdk for lambda is used through maven dependency

<dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-lambda</artifactId>
    <version>1.11.681</version>
    </dependency>

@Override public String handleRequest(final Object input, final Context context) {

    logger.log(context.getFunctionName() + " invoked");

    logger.log(context.getFunctionName() + " returned");

    return input.toString();

}

Upvotes: 1

Views: 520

Answers (1)

Christian
Christian

Reputation: 576

Timeout with no further log output sounds like a typical networking-issue, I'd start looking there.

To reach the Lambda service, the calling Lambda (and with that your VPC) needs access to the Internet, have you got an Internet Gateway or NAT Interface/Gateway in the VPC?

Alternatively, instead of directly invoking the Lambda, you could go over SNS, that would allow you to add an SNS Interface endpoint in your VPC, if connecting your VPC to the Internet is not an option.

Upvotes: 1

Related Questions