如何在 Test Kitchen 中将我的自定义 AMI 与 ec2 驱动程序一起使用?
How do I use my custom AMI with the ec2 driver in Test Kitchen?
我不确定我遗漏了什么,但测试 ktichen 忽略了我的自定义 CentOS AMI。它不是启动正确的 AMI,而是启动 Ubuntu AMI。这是我的 kitchen.yml:
---
driver:
name: ec2
aws_ssh_key_id: chef
security_group_ids: ["sg-b57021c0", "sg-fga04293"]
subnet_id: subnet-58721c1d
region: us-east-2
require_chef_omnibus: true
instance_type: t2.micro
associate_public_ip: true
provisioner:
name: chef_zero
policyfile: Policyfile.rb
platforms:
- name: import-ami-ffpxv46d
image_id: ami-ffpxv46d
transport:
ssh_key: /user/ami.pem
username: root
suites:
- name: default
provisioner:
policyfile: Policyfile.rb
你必须将 image_id
放在驱动程序配置下,如下所示:
platforms:
- name: import-ami-ffpxv46d
driver:
image_id: ami-ffpxv46d
transport:
ssh_key: /user/ami.pem
username: root
否则 TK 会将其视为实例配置的一部分。
我不确定我遗漏了什么,但测试 ktichen 忽略了我的自定义 CentOS AMI。它不是启动正确的 AMI,而是启动 Ubuntu AMI。这是我的 kitchen.yml:
---
driver:
name: ec2
aws_ssh_key_id: chef
security_group_ids: ["sg-b57021c0", "sg-fga04293"]
subnet_id: subnet-58721c1d
region: us-east-2
require_chef_omnibus: true
instance_type: t2.micro
associate_public_ip: true
provisioner:
name: chef_zero
policyfile: Policyfile.rb
platforms:
- name: import-ami-ffpxv46d
image_id: ami-ffpxv46d
transport:
ssh_key: /user/ami.pem
username: root
suites:
- name: default
provisioner:
policyfile: Policyfile.rb
你必须将 image_id
放在驱动程序配置下,如下所示:
platforms:
- name: import-ami-ffpxv46d
driver:
image_id: ami-ffpxv46d
transport:
ssh_key: /user/ami.pem
username: root
否则 TK 会将其视为实例配置的一部分。