|
| 1 | +Creating EC2 Images with Boxgrinder |
| 2 | +=================================== |
| 3 | + |
| 4 | +Introduction |
| 5 | +------------ |
| 6 | + |
| 7 | +Creating your own custom images for EC2 is a quick and easy process. While there are many ways to create an EC2 image, this page will walk you through using `boxgrinder <http://boxgrinder.org/>`_. Boxgrinder is chosen here because the packages are in Fedora, and it is a simple process that anyone can use. The Cloud SIG maintains basic appliance definition files in the `cloud-kickstarts git repository <http://git.fedorahosted.org/git/?p=cloud-kickstarts.git/>`_ on fedorahosted.org. |
| 8 | + |
| 9 | +Local creation or EC2 based creation |
| 10 | +------------------------------------ |
| 11 | + |
| 12 | +Install Boxgrinder on your existing Fedora host by running: |
| 13 | + |
| 14 | +.. code-block:: bash |
| 15 | +
|
| 16 | + # dnf install -y rubygem-boxgrinder-core rubygem-boxgrinder-build |
| 17 | +
|
| 18 | +Or, if you would rather have the image creation and publish happen on AMI hosts and save the upload time, you can run boxgrinder in one of the project supported `meta-appliances <http://boxgrinder.org/download/boxgrinder-build-meta-appliance/>`_. |
| 19 | + |
| 20 | +Configuration |
| 21 | +------------- |
| 22 | + |
| 23 | +First create a config file at ``/root/.boxgrinder/config`` using the following template. Insert appropriate values, see: http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin, for more information. |
| 24 | + |
| 25 | +.. code-block:: bash |
| 26 | +
|
| 27 | + plugins: |
| 28 | + s3: |
| 29 | + access_key: AWS_ACCESS_KEY # (required) |
| 30 | + secret_access_key: AWS_SECRET_ACCESS_KEY # (required) |
| 31 | + bucket: stormgrind-test # (required) |
| 32 | + account_number: 0000-0000-0000 # (required) |
| 33 | + path: /images # default: / |
| 34 | + cert_file: /home/a/cert-ABCD.pem # required only for ami type |
| 35 | + key_file: /home/a/pk-ABCD.pem # required only for ami type |
| 36 | + ebs: |
| 37 | + access_key: AWS_ACCESS_KEY # required |
| 38 | + secret_access_key: AWS_SECRET_ACCESS_KEY # required |
| 39 | + account_number: AWS_ACCOUNT_NUMBER # required |
| 40 | + delete_on_termination: false # default: true |
| 41 | +
|
| 42 | +Creation |
| 43 | +-------- |
| 44 | + |
| 45 | +Actual image creation requires an appliance definition file to get started. The Cloud SIG maintains basic configuration files for current Fedora releases in `cloud-kickstarts git repository <http://git.fedorahosted.org/git/?p=cloud-kickstarts.git/>`_ on fedorahosted.org. You can grab the configuration file from the boxgrinder directory here, and modify it add packages as necessary for your application. More advanced configuration instructions, including post install scripting, are available on the `boxgrinder website <http://boxgrinder.org/tutorials/appliance-definition/>`_. Once you have the configuration file you want, it is as simple as running a single command: |
| 46 | + |
| 47 | +For an S3 backed image: |
| 48 | + |
| 49 | +.. code-block:: bash |
| 50 | +
|
| 51 | + # boxgrinder-build /path/to/your/fedora.appl -p ec2 -d ami |
| 52 | +
|
| 53 | +For an EBS backed image: |
| 54 | + |
| 55 | +.. code-block:: bash |
| 56 | +
|
| 57 | + # boxgrinder-build /path/to/your/fedora.appl -p ec2 -d ebs |
| 58 | +
|
| 59 | +
|
| 60 | +This will build your image, upload it, and register the AMI, though you will have to make it public yourself. Note that boxgrinder works through plugins, and everything is done in steps. If you want both S3 and EBS based images, run the commands in order, and the EBS image will use the output from the S3 backed to save considerable time. If you require any assistance, people are always willing to help on irc.freenode.net in `#fedora-cloud <irc://irc.freenode.net/fedora-cloud/>`_, or on the `fedora-cloud-sig mailing list <https://admin.fedoraproject.org/mailman/listinfo/cloud/>`_. |
0 commit comments