The Access Key ID or security token is invalid.
exception after upgrading DynamoDB Local
Introduction:
DynamoDB Local is a valuable tool for developers to test and develop applications without incurring AWS costs. However, after upgrading to version 2.0 or later, some users may encounter an error message stating "The Access Key ID or Security Token is Invalid." This blog post aims to shed light on this issue and provide a simple solution to resolve it.
The Error:
After updating DynamoDB Local to version 2.0 or higher, you might notice that your applications are failing to authenticate with the service, resulting in the "The Access Key ID or Security Token is Invalid" error. This issue typically arises due to a change in the naming convention for the Access Key ID, which was introduced in DynamoDB Local version 2.0.0 and later.
The Solution:
The resolution to this problem is straightforward: adhere to the new naming convention for the Access Key ID when using DynamoDB Local version greater than 1.23.0 or 2.0.0. The updated convention specifies that the AWS_ACCESS_KEY_ID
can only contain letters (A–Z, a–z) and numbers (0–9).
Previously, the Access Key ID might have allowed special characters, but with the latest version, only alphanumeric characters are permissible. Therefore, if your Access Key ID contains any special characters, you need to generate a new Access Key ID that conforms to the new guidelines.
Conclusion:
By following the correct naming convention for the Access Key ID introduced in DynamoDB Local version 2.0.0 and later, you can overcome the "The Access Key ID or Security Token is Invalid" error. Generating a new Access Key ID with only letters and numbers and updating your application's configuration will enable you to seamlessly interact with DynamoDB Local in your development environment.