我正在厨师中使用AWS Cook Book,并添加了VPC创建:
my_vpc = aws_vpc 'my_vpc' do
cidr_block '10.0.0.0/24'
main_routes '0.0.0.0/0' => :internet_gateway
internet_gateway true`enter code here`
end
my_sg = aws_security_group 'my_sg' do
vpc lazy { my_vpc.aws_object.id }
inbound_rules '0.0.0.0/0' => [ 22, 80 ]
end
my_subnet = aws_subnet 'my_subnet' do
vpc lazy { my_vpc.aws_object.id }
cidr_block '10.0.0.0/24'
availability_zone 'eu-west-1a'
map_public_ip_on_launch true
end
machine 'my_machine' do
machine_options(
lazy do
{
bootstrap_options: {
subnet_id: my_subnet.aws_object.id,
security_group_ids: [my_sg.aws_object.id]
}
}
end
)
end
我遇到“未定义的方法”错误
undefined method `aws_vpc' for cookbook: chef-aws, recipe: default :Chef::Recipe
我找到了厨师aws供应的替代解决方案。
在超市使用aws食谱。
要在AWS中创建cloudformation堆栈
使用云形成模板然后在AWS中创建自己的基础结构。