Java Callout error with getenv AWS_PROFILE in AWS Java SDK

I am using the AWS Java SDK to make a call to AWS Lambda. The SDK seems to make a call to getenv(AWS_PROFILE) and Apigee blocks getenv calls in Java callout resulting in a RuntimeException.

Is there a preferred way to configure AWS SDK to avoid the call to getenv.

Solved Solved
0 6 711
1 ACCEPTED SOLUTION

Former Community Member
Not applicable

System.getenv is blocked by Apigee. If AWS Java SDK uses this method, then you won't be able to use the SDK in Apigee (for now). If this is code you've written in the callout, you'll have to find alternatives.

View solution in original post

6 REPLIES 6

Former Community Member
Not applicable

System.getenv is blocked by Apigee. If AWS Java SDK uses this method, then you won't be able to use the SDK in Apigee (for now). If this is code you've written in the callout, you'll have to find alternatives.

@madhans were you able to find a way to work around this? If so can you please post the details

Thanks

vijaymurali,
Refer to this page for Apigee and Lambda integration. It should also work for other AWS APIs.
https://www.googlecloudcommunity.com/gc/Cloud-Product-Articles/ApigeeX-and-AWS-Lambda/ta-p/427109

Any solution to avoid this error??

access denied ("java.lang.RuntimePermission" "getenv.AWS_PROFILE")

Former Community Member
Not applicable

You cannot use that library as-is.

Perhaps an approach built by @Miguel Mendoza here can help you.

As far as I know, You cannot use the Java SDK for AWS in an Apigee callout, because of the restriction we have described. There is no "workaround", as far as I know, that would allow you to use the AWS SDK. 

If you have a specific requirement - for example "generate an AWS v4 signature" - there are ways you can do that without the AWS SDK.  so there may be ways to get where you want to go, depending on your goal.