Skip to content

Commit d7bdc44

Browse files
lukeseawalkersean-smith
authored andcommitted
Add documentation for the createami cli command
Signed-off-by: Luca Carrogu <[email protected]>
1 parent 58e0ed2 commit d7bdc44

File tree

4 files changed

+349
-424
lines changed

4 files changed

+349
-424
lines changed

docs/source/ami_customization.rst

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,28 @@ Building a custom AWS ParallelCluster AMI
1010
.. warning::
1111
Building a custom AMI is not the recommended approach for customizing AWS ParallelCluster.
1212

13-
Once you build your own AMI, you will no longer receive updates or bug fixes with future releases of AWS ParallelCluster. You will need to repeat the steps used to create your custom AMI with each new AWS ParallelCluster release.
13+
Once you build your own AMI, you will no longer receive updates or bug fixes with future releases of AWS ParallelCluster. You will need to repeat the steps used to create your custom AMI with each new AWS ParallelCluster release.
1414

1515
Before reading any further, take a look at the :doc:`pre_post_install` section of the documentation to determine if the modifications you wish to make can be scripted and supported with future AWS ParallelCluster releases
1616

17-
While not ideal, there are a number of scenarios where building a custom AMI for AWS ParallelCluster is necessary. This tutorial will guide you through the process.
17+
While not ideal, there are a number of scenarios where building a custom AMI for AWS ParallelCluster is necessary. This tutorial will guide you through the process.
1818

1919
How to customize the AWS ParallelCluster AMI
2020
============================================
2121

22-
The base AWS ParallelCluster AMI is often updated with new releases. This AMI has all of the components required for AWS ParallelCluster to function installed and configured. If you wish to customize an AMI for AWS ParallelCluster, you must start with this as the base.
22+
There are three ways to use a custom AWS ParallelCluster AMI, two of them require to build a new AMI that will be available under your AWS account and one does not require to build anything in advance. Feel free to select the
23+
appropriate method based on your needs.
24+
25+
Modify an AWS ParallelCluster AMI
26+
---------------------------------
27+
28+
This is the safest method as the base AWS ParallelCluster AMI is often updated with new releases. This AMI has all of the components required for AWS ParallelCluster to function installed and configured and you can start with this as the base.
2329

2430
#. Find the AMI which corresponds with the region you will be utilizing in the list here: https://github.com/aws/aws-parallelcluster/blob/master/amis.txt.
2531
#. Within the EC2 Console, choose "Launch Instance".
2632
#. Navigate to "Community AMIs", and enter the AMI id for your region into the search box.
2733
#. Select the AMI, choose your instance type and properties, and launch your instance.
28-
#. Log into your instance using the ec2-user and your SSH key.
34+
#. Log into your instance using the OS user and your SSH key.
2935
#. Customize your instance as required
3036
#. Run the following command to prepare your instance for AMI creation::
3137

@@ -34,3 +40,49 @@ The base AWS ParallelCluster AMI is often updated with new releases. This AMI h
3440
#. Stop the instance
3541
#. Create a new AMI from the instance
3642
#. Enter the AMI id in the :ref:`custom_ami_section` field within your cluster configuration.
43+
44+
Build a Custom AWS ParallelCluster AMI
45+
--------------------------------------
46+
47+
If you have an AMI with a lot of customization and software already in place, you can apply the changes needed by AWS ParallelCluster on top of it.
48+
49+
For this method you have to install the following tools in your local system, together with the AWS ParallelCluster CLI:
50+
51+
#. Packer: grab the latest version for your OS from `Packer website <https://www.packer.io/downloads.html>`_ and install it
52+
#. ChefDK: grab the latest version for your OS from `ChefDK website <https://downloads.chef.io/chefdk/>`_ and install it
53+
54+
Verify that the commands 'packer' and 'berks' are available in your PATH after the above tools installation.
55+
56+
You need to configure your AWS account credentials so that Packer can make calls to AWS API operations on your behalf.
57+
The minimal set of required permissions necessary for Packer to work are documented in the `Packer doc <https://www.packer.io/docs/builders/amazon.html#iam-task-or-instance-role>`_.
58+
59+
Now you can use the command 'createami' of the AWS ParallelCluster CLI in order to build an AWS ParallelCluster AMI starting from the one you provide as base::
60+
61+
pcluster createami --ami-id <BASE AMI> --os <BASE OS AMI>
62+
63+
For other parameters, please consult the command help::
64+
65+
pcluster createami -h
66+
67+
The command executes Packer, which does the following steps:
68+
69+
#. Launch an instance using the base AMI provided.
70+
#. Apply the AWS ParallelCluster cookbook to the instance, in order to install software and perform other necessary configuration tasks.
71+
#. Stop the instance.
72+
#. Creates an new AMI from the instance.
73+
#. Terminates the instance after the AMI is created.
74+
#. Outputs the new AMI ID string to use to create your cluster.
75+
76+
To create your cluster enter the AMI id in the :ref:`custom_ami_section` field within your cluster configuration.
77+
78+
.. note:: The instance type to build a custom AWS ParallelCluster AMI is a t2.xlarge and does not qualify for the AWS free tier. You are charged for any instances created when building this AMI.
79+
80+
Use a Custom AMI at runtime
81+
---------------------------
82+
83+
If you don't want to create anything in advance you can just use your AMI and create a AWS ParallelCluster from that.
84+
85+
Please notice that in this case the AWS ParallelCluster creation time will take longer, as it will install every software needed by AWS ParallelCluster at cluster creation time.
86+
Also scaling up for every new node will need more time.
87+
88+
#. Enter the AMI id in the :ref:`custom_ami_section` field within your cluster configuration.

docs/source/ami_development.rst

Lines changed: 0 additions & 153 deletions
This file was deleted.

0 commit comments

Comments
 (0)