我正在尝试创建一个CloudFormation堆栈,但得到:
ID为air airflow-layer的堆栈不存在或已被删除
气流层是我正在创建的云形成堆栈的名称。自动引用我正在创建的堆栈的正确方法是什么?
{
"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"
}
}
}
答案 0 :(得分:2)
我跑步时遇到了这个错误" cfn-init"没有" - 地区"。包括它可以解决问题。