Introduction
Packer is an open source tool for creating identical machine images for multiple platforms from a single source configuration. Packer is lightweight, runs on every major operating system, and is highly performant, creating machine images for multiple platforms in parallel.
Using the CloudCenter platform we can directly use packer to create AMIs in AWS and add the image mapping to CloudCenter to be used by various application profiles. This helps with image management in the public cloud using CloudCenter. Note in this example, during image mapping we will leave the mapping of the instance types empty. Once the images are mapped, the user will have to edit the mapping to choose the right instance type they would like to make available for this image.
The service highlights how we can use packer to create a Centos image in AWS. This script is an example usage of Packer. You can leverage this integration to create more advance deployments.
Prerequisites
CloudCenter
- CloudCenter 4.8.x and above
- CloudCenter Orchestrator running on AWS
Service Package Bundle
The Packer Service bundle consists of the following files:
- service - The main script that has the logic for the integration
- serviceDictionary.csv - The dictionary CSV file that has the list of all the parameters and their defaults. If you want to get addition input from the user, they need to be added to this file and also in the UI. The format of this file is as follows:
- DisplayName,paramName,paramType,defaultValue,visible,optional
- e.g. Root Volume Size,root_volume_size,10,Y,N
The parameter name is key here and should match the parameter name in the UI
- packer-builder-amazon-ebs - The
amazon-ebs
Packer builder is able to create Amazon AMIs backed by EBS volumes for use in EC2
Service Description
When using Packer we need to provide parameters for the template that is used to build the image. This example integration provides a sample template to create a Centos image. Users can modify these parameters and create their own templates based on their use case
To add this service login to CloudCenter as an administrator and click on Admin->Services->Add Service. Use the information listed below to create the service.
Service Type: External Service
Name: Packer
Service ID: packerbuild
Description: Packer is an open source tool for creating identical machine images for multiple platforms from a single source configuration.
Category: Custom Service
External Lifecycle Actions:
External Action Bundle: <location of packerbuild.zip>
Start:
Script from Bundle: service start
Service Parameters
| |
---|
Parameter Name | api_user |
Display Name | CloudCenter API User |
Type | string |
Default Value | cliqradmin |
User Options | |
| |
---|
Parameter Name | api_key |
Display Name | CloudCenter API Key |
Type | string |
Default Value | |
User Options | |
| |
---|
Parameter Name | ccm_url |
Display Name | CloudCenter CCM URL |
Type | string |
Default Value | <your ccm ip> |
User Options | |
Deployment Parameters
| |
---|
Parameter Name | ami_name |
Display Name | AMI Name |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | source_ami |
Display Name | Source AMI |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | subnet_id |
Display Name | Subnet ID |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | vpc_id |
Display Name | VPC ID |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | instance_type |
Display Name | Instance Type |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | ssh_username |
Display Name | SSH Username |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | virtualization |
Display Name | Virtualization |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | root_volume_size |
Display Name | Root Volume Size |
Type | string |
Default Value | 10 |
User Options | Visible, Editable |
| |
---|
Parameter Name | log_volume_size |
Display Name | Log Volume Size |
Type | string |
Default Value | 10 |
User Options | Visible, Editable |
| |
---|
Parameter Name | region |
Display Name | AWS Region |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | template_url |
Display Name | Packer Template Location |
Type | path |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | provisioner_script_url |
Display Name | Provisioner Script Location |
Type | path |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | image_name |
Display Name | CloudCenter Image Name |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | image_desc |
Display Name | CloudCenter Image Description |
Type | string |
Default Value | |
User Options | Visible, Editable |
| |
---|
Parameter Name | os_type |
Display Name | CloudCenter Image OS Type |
Type | list |
List Values | LINUX,WINDOW |
Default Value | LINUX |
User Options | Visible, Editable |
Downloads