Create Image
On this page
In this article, you will learn how to build custom image using Packer.
Prerequisites
You must have created the aws-dev IAM user and set the secret keys environment variables as explained in Create IAM User.
Packer Setup
On Mac, install packer using Brew:
Check version:
You can upgrade to latest version by running:
Packer Workflow
Clone the project:
Go into the packer directory and run:
Validate:
Build image:
This runs on a c5.4xlarge EC2 instance and takes about 20 minutes to build the custom image. You will be charged by AWS. You can save time and money by using the prebuilt image.
The Packer template needs to be modified to copy images to all AWS regions. For sharing the image with anyone this step is required. However this will incur costs. Check tasks/regions.md file in learning-nuxt project.
You need to follow these steps only if you make changes to the aws-ubuntu.pkr.hcl or any of the Ansible playbooks in the ansible directory. If the default image meets your needs you can use it to provision a EC2 instance using the Terraform template. This is covered in Provision Server.
If the default image does not meet your needs, post on discussions with your requirements. I can help you customize the image.