Skip to content

Commit 420efe9

Browse files
authored
Merge pull request localstack#389 from localstack/matt-wormley/master
Set default AWS settings via config file rather than environment variables
2 parents b1f6fba + 8d1edd7 commit 420efe9

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ RUN mkdir -p /.npm && \
4646
ln -s `pwd` /tmp/localstack_install_dir
4747

4848
# expose default environment (required for aws-cli to work)
49-
ENV AWS_ACCESS_KEY_ID=foobar \
50-
AWS_SECRET_ACCESS_KEY=foobar \
51-
AWS_DEFAULT_REGION=us-east-1 \
52-
MAVEN_CONFIG=/opt/code/localstack \
49+
ENV MAVEN_CONFIG=/opt/code/localstack \
5350
USER=localstack
5451

52+
# set test AWS credentials and default region in config file
53+
RUN mkdir -p /root/.aws && \
54+
echo '[default]' > /root/.aws/config && \
55+
echo 'region = us-east-1' >> /root/.aws/config && \
56+
echo '[default]' > /root/.aws/credentials && \
57+
echo 'aws_access_key_id = foobar' >> /root/.aws/credentials && \
58+
echo 'aws_secret_access_key = foobar' >> /root/.aws/credentials
59+
5560
# expose service & web dashboard ports
5661
EXPOSE 4567-4583 8080
5762

localstack/utils/aws/aws_stack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def connect_to_service(service_name, client=True, env=None, region_name=None, en
146146
if env.region == REGION_LOCAL:
147147
endpoint_url = get_local_service_url(service_name)
148148
verify = False
149-
region = env.region if env.region != REGION_LOCAL else DEFAULT_REGION
149+
region = env.region if env.region != REGION_LOCAL else None
150150
return method(service_name, region_name=region, endpoint_url=endpoint_url, verify=verify)
151151

152152

0 commit comments

Comments
 (0)