Troubleshooting "The Access Key ID or Security Token is Invalid" Error after Upgrading DynamoDB Local to Version 2.0.0 / 1.23.0 or Greater

2 minuto de leitura
Nível de conteúdo: Intermediário
2

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.

profile pictureAWS
ESPECIALISTA
publicada há 9 meses7819 visualizações
2 Comentários

One reason you might encounter this behaviour is using non-maintained packages, which still use the older behaviour internally. This is discussed in https://github.com/99x/serverless-dynamodb-local/pull/298

To fix this, upgrade the packages to maintained forks (disclaimer: I am a contributor to these forks), for example:

respondeu há 9 meses
profile picture
respondeu há 9 meses