[[linux_wiki:ec2_create_ami_templates]]

EC2: Create AMI Templates

General Information

Custom Amazon Machine Images (VM Templates).

Checklist

  • AWS Account

General AMI Creation Instructions

  • Choose AMI: This matters
    • Select the OS that you want the image to be modeled after
  • Instance type:
    • This does not matter for the template, as the instance type is prompted every time.
  • Configure Instance:
    • Launch somewhere you get login and customize the instance for template creation.
  • Add Storage: This matters
    • Select the disk you want to be selected by default for the template.
    • This is also prompted every time, but will retain the template selections by default.
  • Add Tags:
    • This does not matter and is prompted every time.
  • Configure Security Group:
    • This does not matter and is prompted every time.
  • Review: This matters
    • Select the SSH Key when launching that will end up baked into the template.
  • Launch Instance, Login, Customize (install/configure)
  • In AWS Console, select the instance
  • Click “Actions” > “Image” > “Create Image”
    • Type an Image name
    • Type an Image description
    • Click “Create Image”

Customization examples that could be baked into an EC2 instance template.


Create an auto updating instance

#!/bin/bash
 
# Update right after launch
yum -y update
 
# Install bash-completion and yum-cron
yum -y install bash-completion vim yum-cron
 
# Set to auto update daily
sed -i 's/apply_updates = no/apply_updates = yes/' /etc/yum/yum-cron.conf
 
# Reboot instance
reboot

  • linux_wiki/ec2_create_ami_templates.txt
  • Last modified: 2019/05/26 03:50
  • (external edit)