AWS profile required with nonsense values, failed to sign request, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded

I was attempting to use localstack to run integration tests against a local dynamodb database when I kept getting errors like this:

Error:      	Target error should be in err chain:
        	            	expected: ""
        	            	in chain: "operation error DynamoDB: Query, failed to sign request: failed to retrieve credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded"
        	            		"operation error DynamoDB: Query, failed to sign request: failed to retrieve credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded"
        	            		"failed to sign request: failed to retrieve credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded"
        	            		"failed to retrieve credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded"
        	            		"failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded"
        	            		"no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded"
        	            		"operation error ec2imds: GetMetadata, request canceled, context deadline exceeded"
        	            		"request canceled, context deadline exceeded"
        	            		"context deadline exceeded"
        	Test:       	TestIntegrationTestSuite/TestRepoListAll
        	Messages:   	ListAll returned err: operation error DynamoDB: Query, failed to sign request: failed to retrieve credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded
    ddb_test.go:27: Found 0 profiles

After much trial and error, i created an AWS profile with nonsense values, e.g:

aws configure
    AWS Access Key ID [None]: test    
    AWS Secret Access Key [None]: test
    Default region name [None]: us-west-2
    Default output format [None]:

And everything worked. Im just curious why, is this intended, is it a bug, etc.

Thanks!

Hi — Apologies for the late response. How are you using LocalStack? With AWS CLI or some other integration?

If you are using AWS CLI, we recommend setting AWS test environment variables so that no API calls are made to the real AWS cloud. You can find this on our documentation here — AWS Command Line Interface | Docs

To navigate around this, you can use awslocal, our wrapper around AWS CLI — AWS Command Line Interface | Docs