I am trying to List all available savings plan in my account using
var savingsPlans = new AWS.SavingsPlans({endpoint: 'savingsplans.amazonaws.com', region: region});
const listResponse: AWS.SavingsPlans.DescribeSavingsPlansResponse = await savingsPlans.describeSavingsPlans().promise();
But getting following error in some scenarios. In some scenarios, it is working fine. What could be the issue? Please help.
"error": {
"message": "Credential should be scoped to a valid region, not 'us-west-2'. ",
"code": "InvalidSignatureException",
"time": "2022-03-04T09:47:56.535Z",
"statusCode": 403,
"retryable": false,
"retryDelay": 97.23145392059766
}
I am running above code for all regions in my account. Fore some regions, I am not getting any error. But for some regions I am getting error. For example: I am getting error for region ap-northeast-1
but I am not getting error for us-east-1
region.
When I run the same code with Go SDK, it is working for both regions. not sure what is wrong here.
This issue is solved when we use v3 aws-sdk version.
import { SavingsplansClient, DescribeSavingsPlansCommand } from "@aws-sdk/client-savingsplans";
const savingsPlans = new SavingsplansClient();
const command = new DescribeSavingsPlansCommand(})
const listResponse = await savingsPlans.send(command);
Seems there are some issues in v2 for savings plans.