1

Currently I am working with Amazon Webservices.
I create one Java lambda function using Eclipse IDE.

After created function in eclipse I test function eclipse using JUnit Test.
Lambda function execute successfully and also inserted data successfully to DynamoDB.

But problem is :

I run function on lambda from Eclipse using Run Function on AWS Lambda functionality.

Data is not inserting and its throwing exception.

I also test this method using API Gateway but get same exception.

Exception : java.lang.IllegalArgumentException: AWS credential profiles file not found in the given path: /home/sbx_user1051/.aws/credentials

Please Friends Help me to solve this problem.

NOTE : I already added full permission for both Lambda Function and DynamoDB.

I am using below code to insert Data to DynamoDB.

DynamoDB dynamoDB = new DynamoDB(new AmazonDynamoDBClient(new ProfileCredentialsProvider("my_default_profile")));

Table table = dynamoDB.getTable(TABLE_NAME);

String login_id = (String) inputHashMap.get("login_id");
String password = (String) inputHashMap.get("password");
String type = (String) inputHashMap.get("type");
String device_id = (String) inputHashMap.get("device_id");

try {
    Exception eItem item = new Item().withPrimaryKey("login_id", login_id)
        .withString("device_id", device_id)
        .withBoolean("isUserVerified", false)
        .withString("password", password)
        .withString("type", type);

    table.putItem(item);
}
catch(Exception e){

}

1 Answer 1

2

Please try creating the DynamoDB object without a profile.

DynamoDB dynamoDB = new DynamoDB(new AmazonDynamoDBClient());

Sign up to request clarification or add additional context in comments.

8 Comments

I already added full permission for both Lambda Function and DynamoDB.
Ok Wait I will be back after create object as you mansion above.
Its Work. But can you tell me one more thing.? If I use only DynamoDB dynamoDB = new DynamoDB(new AmazonDynamoDBClient()); Will Any problem arise?
Now I m getting this exception : com.amazonaws.AmazonClientException: Unable to load AWS credentials from any provider in the chain
Thanks for the Help.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.