Reputation: 8374
I am trying to create a CloudFormation Stack but getting:
Stack with id airflow-layer does not exist or has been deleted
The airflow-layer is the name of the cloud formation stack that I am creating. What is the correct way to auto reference the stack that I am creating?
{
"Description": "AWS CloudFormation to airflow",
"Resources": {
"AirflowEC2": {
"Metadata": {
"AWS::CloudFormation::Init": {
"configSets": {
"install_airflow": [
"install_airflow"
]
},
"install_airflow": {
"commands": {
"test": {
"command": "echo Ola mundo"
}
}
}
}
},
"Properties": {
"ImageId": "ami-9abea4fb",
"InstanceType": "t2.micro",
"KeyName": "CLOUD_ADMIN",
"SecurityGroupIds": [
"sg-03851765"
],
"SubnetId": "subnet-0820796d",
"Tags": [
{
"Key": "Name",
"Value": "ec2-airflow-production"
}
],
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash -xe\n",
"sudo apt-get update\n",
"sudo apt-get -y install python-setuptools\n",
"sudo apt-get -y install python-pip\n",
"sudo pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
"cfn-init -s '",
{
"Ref": "AWS::StackName"
},
"' -r AirflowEC2 -c install_airflow"
]
]
}
}
},
"Type": "AWS::EC2::Instance"
},
"AirflowElasticIP": {
"Properties": {
"AllocationId": "eipalloc-7214ae17",
"InstanceId": {
"Ref": "AirflowEC2"
}
},
"Type": "AWS::EC2::EIPAssociation"
}
}
}
Upvotes: 2
Views: 2845
Reputation: 529
I got this error when I ran "cfn-init" without a "--region". Including it fixes the problem.
Upvotes: 5