chef-provisioning-aws
chef-provisioning-aws copied to clipboard
Working example for machine_image to create instance store AWS image
Is there good working example for creating an instance store AWS Image? I was able to successfully create machine images that are backed by ebs easily using 'machine_image' resource. But I am completely out of luck doing the same for instance store images. My other alternative is to use a tool like packer which does build Instance store backed AMIs But I rather stick to Chef Provisioning. Any help is much appreciated.
machine_image 'testing-image' do
from_image 'ami-4f0b8026'
machine_options bootstrap_options: {
security_group_ids: 'test3-security-group',
subnet_id: 'test3-subnet',
key_name: 'key-pair-dev',
key_path: '/root/.ssh/key-pair-dev.pem',
instance_type: 'm1.large',
kernel_id: 'aki-b4aa75dd',
block_device_mappings: [{
device_name: 'sdb',
virtual_name: 'ephemeral0'
}],
},
ssh_username: 'root'
end
@vinodhalaharvi not totally sure if this is the issue since you didn't paste your errors, but machine_options is not set correctly in your example, so ssh_username is getting passed as a machine_image attribute and not machine_options attribute
you want something like:
machine_image 'testing-image' do
from_image 'ami-4f0b8026'
machine_options(
bootstrap_options: {
security_group_ids: 'test3-security-group',
subnet_id: 'test3-subnet',
key_name: 'key-pair-dev',
key_path: '/root/.ssh/key-pair-dev.pem',
instance_type: 'm1.large',
kernel_id: 'aki-b4aa75dd',
block_device_mappings: [{
device_name: 'sdb',
virtual_name: 'ephemeral0'
}],
},
ssh_username: 'root'
)
end