This repository was archived by the owner on Mar 23, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Can not create Firehose with CloudFormation in localstack #2022
Copy link
Copy link
Closed
Description
I've a cloudformation template which works on AWS:
AWSTemplateFormatVersion: '2010-09-09'
Description: tests
Resources:
# Kinesis Stream
KinesisStream:
Type: AWS::KinesisFirehose::DeliveryStream
Properties:
DeliveryStreamName: knStream
DeliveryStreamType: DirectPut
S3DestinationConfiguration:
BucketARN: !GetAtt KinesisBucket.Arn
BufferingHints:
IntervalInSeconds: 300
SizeInMBs: 5
CompressionFormat: UNCOMPRESSED
RoleARN: !GetAtt KinesisToS3Role.Arn
KinesisToS3Role:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- firehose.amazonaws.com
Action:
- 'sts:AssumeRole'
#todo
Path: /
Policies:
- PolicyName: KinesisFirehoseS3Policy
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action: '*'
Resource: '*'
KinesisBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: kinesis-lvthillo-bucket
I try to deploy it in localstack:
This is my docker-compose for localstack:
version: '3.5'
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
image: localstack/localstack
ports:
- "4567-4599:4567-4599"
- "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
environment:
- SERVICES=${SERVICES- }
- DEBUG=${DEBUG- }
- DEFAULT_REGION=us-east-1
- DATA_DIR=${DATA_DIR- }
- PORT_WEB_UI=${PORT_WEB_UI- }
- LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
- KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
- DOCKER_HOST=unix:///var/run/docker.sock
networks:
- aws-local-network
#volumes:
# - "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
# - "/var/run/docker.sock:/var/run/docker.sock"
networks:
aws-local-network:
driver: bridge
Command to deploy:
aws cloudformation --endpoint http://localhost:4581 --region us-east-1 create-stack --template-body file://template.yml --stack-name test --capabilities CAPABILITY_IAM
Unable to parse response (syntax error: line 1, column 54), invalid XML received:
b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500 Internal Server Error</title>\n<h1>Internal Server Error</h1>\n<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>\n'
What is wrong here. on AWS it all seems to work.
UPDATE: debug logs
'Version': datetime.date(2012, 10, 17), 'Statement': [{'Effect': 'Allow', 'Principal': {'Service': ['firehose.amazonaws.com']}, 'Action': ['sts:AssumeRole']}]}, 'Path': '/', 'Policies': [{'PolicyName': 'KinesisFirehoseS3Policy', 'PolicyDocument': {'Version': datetime.date(2012, 10, 17), 'Statement': [{'Effect': 'Allow', 'Action': '*', 'Resource': '*'}]}}]}}
2020-02-10T19:49:27:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "IAM::Role" id "KinesisToS3Role"
2020-02-10T19:49:27:ERROR:localstack.services.cloudformation.cloudformation_starter: Unable to parse and create resource "KinesisToS3Role": Object of type date is not JSON serializable Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 186, in parse_and_create_resource
resources_map, region_name, force_create=force_create)
File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 287, in _parse_and_create_resource
result = deploy_func(logical_id, resource_map_new, stack_name=stack_name)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 823, in deploy_resource
return execute_resource_action(resource_id, resources, stack_name, ACTION_CREATE)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 849, in execute_resource_action
result = configure_resource_via_sdk(resource_id, resources, resource_type, func, stack_name)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 865, in configure_resource_via_sdk
params = params(resource_props, stack_name=stack_name, resources=resources)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 96, in replace
result = param_func(params, **kwargs)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 89, in replace
result[name] = json.dumps(result[name])
File "/usr/lib/python3.7/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.7/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.7/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python3.7/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type date is not JSON serializable
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels