AWSSecretsManager ResourceNotFoundException

0

Hi ,

I am using Java SDK [1.12.166] for secret manager to store and retrieve secrets. After successfully storing the secrets, intermittently getting below exception while retrieving the same. Surprisingly, first time retrieval was successful, second attempt failed with below exception, however it worked on the third attempt. Not sure on what i am missing here ..
Service: AWSSecretsManager; Status Code: 400; Error Code: ResourceNotFoundException; Request ID:

Appreciate any help regarding this.

Thanks, Anand

asked 2 years ago1148 views
1 Answer
0

The error message you shared "ResourceNotFoundException" with a status code of 400 is usually occurs when the specified resource (secret) is not found. Secrets Manager could not have found the resource that you asked for. However since you advised that you are able to retrieve the secret the first time and it fails for subsequent API calls when using the AWS Secrets Manager SDK in Java this could be an issue of using a secret name versus secret Amazon Resource Name (ARN) which might be bringing the inconsistencies.

In your case I would like to confirm if you are using the secret name or the secret ARN when retrieving the secret from Secrets Manager?

When retrieving secrets from AWS Secrets Manager we recommend that you consider using the secret’s ARN as compared to using the secret name, just in case there are instances your code does partial ARN matching : https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen.

Also by using the secret ARN, you can minimize potential errors due to incorrect secret names, and improve consistency and reliability of your interactions with AWS Secrets Manager. For more information see https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html

In the event that you have not been using the secret ARN I therefore kindly request that you test using the secret ARN with your code and advise if this issue still occurs.

I will also recommend that you open a support case if the issue persists to allow our team to check on your specific issue : https://console.aws.amazon.com/support/home

AWS
Lucky_M
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions