-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Hi there,
Although Localstack looks quite promising, since a couple of weeks ago our team is a bit blocked due to an issue we are experiencing with CloudFormation.
Any help would be more than welcome.
Having a docker-compose like this:
version: '3'
services:
gateway:
image: app
depends_on:
- localstack
environment:
- AWS_ACCESS_KEY_ID=localkey
- AWS_SECRET_ACCESS_KEY=localsecret
localstack:
container_name: localstack
image: localstack/localstack
expose:
- "4567-4599"
ports:
- "4567-4599:4567-4599"
environment:
- SERVICES=iam, lambda, s3, cloudformation, sqs, sts
- LAMBDA_EXECUTOR=docker
- DOCKER_HOST=unix:///var/run/docker.sock
- LAMBDA_REMOTE_DOCKER=true
- HOSTNAME_EXTERNAL=localstack
- HOSTNAME=localstack
- DEBUG=1
volumes:
- "/tmp/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
Gateway container it is just a container with several tools pre-installed like (awscli ... ) to be used as an entry point for the inner network.
From that gateway container we can successfully run :
aws --endpoint-url=http://localstack:4572 s3api create-bucket --bucket serverlessdeploy --region us-east-1 --create-bucket-configuration LocationConstraint=us-east-1
Even upload object to it (hitting http://localstack:4572 with the following parameters):
{
Body: <Buffer 7b 22 41 57 53 54 65 6d 70 6c 61 74 65 46 6f 72 6d 61 74 56 65 72 73 69 6f 6e 22 3a 22 32 30 31 30 2d 30 39 2d 30 39 22 2c 22 44 65 73 63 72 69 70 74 ... 2768 more bytes>,
Bucket: 'mybucket',
Key: 'whatever/local/1584035954811-2020-03-12T17:59:14.811Z/compiled-cloudformation-template.json',
ContentType: 'application/json',
Metadata: { filesha256: 'h003I5m1ox/MQ+ia+9zyvGQ38kOrHTI62EVft/J6aIc=' }
}
But when we try to create an stack hitting CloudFormation (http://localstack:4581) with the following params:
{
StackName: 'whatever',
OnFailure: 'DELETE',
Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ],
Parameters: [ [length]: 0 ],
TemplateURL: 'http://localstack:4572/mybucket/whatever/local/1584035954811-2020-03-12T17:59:14.811Z/compiled-cloudformation-template.json',
Tags: [ { Key: 'STAGE', Value: 'local' }, [length]: 1 ]
}
We receive the following error:
"CreateStack" (404) POST /: b'<?xml version="1.0" encoding="UTF-8"?>\n<Error>\n <Code>NoSuchBucket</Code>\n <Message>The specified bucket does not exist</Message>\n <BucketName>localstack:4572</BucketName>\n <RequestID>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestID>\n</Error>'
Additional Info:
Docker daemon it is not in the host machine
Operating System: Linux/4.14.146-119.123.amzn2.x86_64
Localstack Version: latest (0.10.8)
Aws cli Version: aws-cli/1.18.20 Python/3.5.3 botocore/1.15.20
Docker Version: 19.03.7, build 7141c199a2
Edit:
If we run same steps locally (having docker daemon in the host machine) we face the following different issue:
HTTP 502
And the stack:
2020-03-13T12:45:02:ERROR:localstack.services.generic_proxy: Error forwarding request: Unable to fetch template body (code 403) from URL http://localstack:4572/mybucket/whatever/local/1584103485885-2020-03-13T12:44:45.885Z/compiled-cloudformation-template.json Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/generic_proxy.py", line 247, in forward
listener_result = listener.forward_request(method=method,
File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_listener.py", line 172, in forward_request
modified_request = transform_template(req_data)
File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_listener.py", line 70, in transform_template
template_body = get_template_body(req_data)
File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_listener.py", line 115, in get_template_body
raise Exception('Unable to fetch template body (code %s) from URL %s' % (status_code, url))
Exception: Unable to fetch template body (code 403) from URL http://localstack:4572/mybucket/whatever/local/1584103485885-2020-03-13T12:44:45.885Z/compiled-cloudformation-template.json
Thanks in advance.