Reputation: 11
I'm trying to perform instance creation through Node.js AWS SDK and I'm using following code for that:
OpsWorks.createInstanceAsync({
InstanceType: config.instanceType,
LayerIds: [config.layerId],
StackId: config.stackId,
RootDeviceType: params.RootDeviceType || 'ebs',
AvailabilityZone: params.AvailabilityZone,
InstanceType: params.InstanceType,
SubnetId: params.SubnetId,
AmiId: config.amiId
});
});
This piece of code works fine when no AmiId is specified (booting completely new instance). In order to reduce deployment time, I planned to use AMI and when added AmiId parameter I'm getting following error:
ValidationException: The AMI ID cannot be set for this OS
Any ides why this happens on OpsWorks (Ubuntu 14.04)?
Thanks
Upvotes: 1
Views: 126
Reputation: 14533
You need to add the OS for the AMI. Use code below.
OpsWorks.createInstanceAsync({
InstanceType: config.instanceType,
LayerIds: [config.layerId],
StackId: config.stackId,
RootDeviceType: params.RootDeviceType || 'ebs',
AvailabilityZone: params.AvailabilityZone,
InstanceType: params.InstanceType,
SubnetId: params.SubnetId,
Os: 'Custom',
AmiId: config.amiId
});
});
Upvotes: 1