2

We currently use this command to create a new ec2 instance with chef:
knife ec2 server create --node-name=prod-apache-1 --availability-zone us-east-1c --image ami-3d4ff254 --distro ubuntu12.04-gems --groups "default" --ssh-key foo --identity-file ~/.ssh/id_rsa --ssh-user ubuntu --flavor m1.small

After this command we then run further chef commands to finish provisioning the server.

I was wondering if it would be possible while first setting up the instance I wanted a 100 gb volume created and mounted at /mnt and to have the ephemeral storage mounted at /tmp or /mnt-ephemeral instead.

If not what further commands in chef would you advise running? I know how to do this via the aws console and can probably figure out how to do it via the ec2 command line tools but I am knew to chef and a bit overwhelmed.

1 Answer 1

1

Looking at the source code for knife-ec2 on Github it would appear that knife ec2 server create supports the following options:

  • --ebs-size to set the size of the boot volume on a boot-from-EBS instance
  • --ephemeral to set device locations where ephemeral volumes should be mapped

These might be helpful. I believe that these settings will just attach the volumes to devices on your new instance; you may need to manage /etc/fstab (which can presumably be done with Chef) to get the devices mounted at appropriate mountpoints.

If you also need to create and mount an additional EBS volume you could, perhaps, patch your local copy of the knife-ec2 plugin to let you do so by adding more entries to the block-device-mapping before the new instance is launched. Or you could create and attach the volume after launch, perhaps using the OpsCode AWS Cookbook to manage this process with Chef.

(For the record, I'm a veteran Puppet user, but I myself am new to Chef and have yet to try these things. Good luck! ;)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .