Localstack: Setting up credentials with localstack

Created on 13 Apr 2017  路  2Comments  路  Source: localstack/localstack

Hi,

We are trialing Atlassian localstack for mocking out Amazon Kinesis in our application.
I can start up the amazon services locally using the provided docker image.

I create a stream on my mocked Kinesis using the following command
aws --endpoint-url=http://localhost:4568 kinesis create-stream --stream-name "integration-test" --shard-count 1
I see the stream was created using the following command:
aws --endpoint-url=http://localhost:4568 kinesis describe-stream --stream-name "integration-test"
"StreamDescription": {
"StreamName": "integration-test",
"StreamARN": "arn:aws:kinesis:us-east-1:000000000000:stream/integration-test",
"StreamStatus": "ACTIVE"
}

The arn is arn:aws:kinesis:us-east-1:000000000000:stream/integration-test

I couldn't find any information in the wiki/readme how I go about setting up my credentials to point at this test stream?
In my tests I can configure the AWS_DEFAULT_REGION. I'm just wondering does anyone know how to configure a global account to match 000000000000 above? It keeps picking up my real amazon account from my credentials.
Also, I specify --endpoint-url in the amazon cli command above. Is it possible to set this globally so that it can be picked up by my aws sdk?

Its probably obvious to most but maybe updating the readme with some instructions how to create these to point at the mocked service

Cheers

documentation

Most helpful comment

  • Regarding account id and credentials: At this stage, LocalStack does not use the IAM authentication mechanism at all. That is, whichever credentials you provide, LocalStack will accept them (or rather ignore them entirely). At some point in the future we will have proper support for authentication/authorization (to support testing of security configuration, IAM policies, etc), but for now this is not supported. If you are concerned about using your real credentials with LocalStack, you can use the following environment variables as an override:
export AWS_ACCESS_KEY_ID=foobar
export AWS_SECRET_ACCESS_KEY=foobar
  • Regarding --endpoint-url: It is currently not possible to specify the endpoint as an environment variable or global configuration. The main problem at this stage is that the endpoints are service-specific, i.e., will be different for each service. There has been a related feature request in the aws-cli repository, see this comment: https://github.com/aws/aws-cli/issues/1270#issuecomment-289890161

I will update the documentation to cover the aspects above (in particular the point regarding credentials).

All 2 comments

  • Regarding account id and credentials: At this stage, LocalStack does not use the IAM authentication mechanism at all. That is, whichever credentials you provide, LocalStack will accept them (or rather ignore them entirely). At some point in the future we will have proper support for authentication/authorization (to support testing of security configuration, IAM policies, etc), but for now this is not supported. If you are concerned about using your real credentials with LocalStack, you can use the following environment variables as an override:
export AWS_ACCESS_KEY_ID=foobar
export AWS_SECRET_ACCESS_KEY=foobar
  • Regarding --endpoint-url: It is currently not possible to specify the endpoint as an environment variable or global configuration. The main problem at this stage is that the endpoints are service-specific, i.e., will be different for each service. There has been a related feature request in the aws-cli repository, see this comment: https://github.com/aws/aws-cli/issues/1270#issuecomment-289890161

I will update the documentation to cover the aspects above (in particular the point regarding credentials).

@pkelly03 There is now an awslocal CLI that allows you to call the local services as follows:

awslocal kinesis create-stream --stream-name "integration-test" --shard-count 1
awslocal kinesis list-streams

It can be installed via:

pip install awscli-local

The repository is here: https://github.com/localstack/awscli-local

Closing this issue for now, feel free to re-open if there are any other issues. Thanks

Was this page helpful?
0 / 5 - 0 ratings