Reputation: 10608
I'm trying to use the Serverless Framework to deploy a Kinesis Firehose that outputs to an ElasticSearch domain.
Since the Firehose needs the ES domain to already exist before it can be created, I am running into this error:
An error occurred: MyFirehoseStream - Domain arn:aws:es:us-east-1:1234567890:domain/my-elastic-search is still being created.
Is there a way to make the Firehose creation wait until after the ES domain creation is complete?
Just in case its helpful, here are the relevant parts of my serverless.yml
file:
fyi, I'm using the serverless-pseudo-parameters
plugin to use #{AWS::Region}
and #{AWS::AccountId}
resources:
Resources:
MyFirehoseStream:
Type: "AWS::KinesisFirehose::DeliveryStream"
Properties:
DeliveryStreamName: "MyFirehoseStream"
DeliveryStreamType: "DirectPut"
ElasticsearchDestinationConfiguration:
BufferingHints:
IntervalInSeconds: 300
SizeInMBs: 5
DomainARN: "arn:aws:es:#{AWS::Region}:#{AWS::AccountId}:domain/my-elastic-search"
IndexName: "myindex"
IndexRotationPeriod: "NoRotation"
RetryOptions:
DurationInSeconds: 300
RoleARN: { "Fn::GetAtt": ["FirehoseBackupBucketRole", "Arn" ] }
S3BackupMode: "FailedDocumentsOnly"
S3Configuration:
BucketARN: { "Fn::GetAtt": ["FirehoseBackupBucket", "Arn" ] }
BufferingHints:
IntervalInSeconds: 300
SizeInMBs: 5
CompressionFormat: "GZIP"
RoleARN: { "Fn::GetAtt": ["FirehoseBackupBucketRole", "Arn" ] }
TypeName: "mytype"
MyElasticSearch:
Type: "AWS::Elasticsearch::Domain"
Properties:
AccessPolicies: ${file(./iam_policies/elastic-search.json)}
DomainName: "my-elastic-search"
ElasticsearchVersion: 6.2
ElasticsearchClusterConfig:
InstanceCount: "1"
InstanceType: "t2.small.elasticsearch"
EBSOptions:
EBSEnabled: true
Iops: 0
VolumeSize: 10
VolumeType: "gp2"
UPDATE:
I have this fixed now, so in case the specifics are helpful for anyone:
I changed the DomainARN
property to { "Fn::GetAtt": ["MyElasticSearch", "DomainArn" ] }
.
The reason I was originally generating the ARN dynamically was because with "Fn::GetAtt"
I originally tried to use just Arn
instead of DomainArn
, which didn't work. Coincidentally though, DomainArn
has been deprecated in the latest version, so if you are using the latest version, Arn
actually would be correct.
Upvotes: 0
Views: 2741
Reputation: 652
Cloudformation resources support the DependsOn
attribute.
resources:
Resources:
MyFirehoseStream:
Type: "AWS::KinesisFirehose::DeliveryStream"
DependsOn: MyElasticSearch
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
Upvotes: 3