Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding EC2 instance type option to use while building the AMI + change current default #488

Merged
merged 2 commits into from
Oct 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions packer/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ APT_KEY='d0a112e067426ab2'

print_usage() {
echo "$0 --localdeb --repo [URL] --target [distribution]"
echo " [--localdeb] Deploy locally built debs Default: false"
echo " [--localdeb] Deploy locally built debs Default: false"
echo " --repo Repository for both install and update, specify .repo/.list file URL"
echo " --repo-for-install Repository for install, specify .repo/.list file URL"
echo " --repo-for-update Repository for update, specify .repo/.list file URL"
Expand All @@ -37,6 +37,7 @@ print_usage() {
echo " [--log-file] Path for log. Default build/ami.log on current dir. Default: build/packer.log"
echo " --target Target cloud (aws/gce/azure), mandatory when using this script directly, and not by soft links"
echo " --arch Set the image build architecture. Valid options: x86_64 | aarch64 . if use didn't pass this parameter it will use local node architecture"
echo " --ec2-instance-type Set EC2 instance type to use while building the AMI. If empty will use defaults per architecture"
exit 1
}
LOCALDEB=0
Expand Down Expand Up @@ -96,7 +97,7 @@ while [ $# -gt 0 ]; do
;;
"--ami-regions"):
AMI_REGIONS=$2
echo "--ami-regions prameter: AMI_REGIONS |$AMI_REGIONS|"
echo "--ami-regions parameter: AMI_REGIONS |$AMI_REGIONS|"
shift 2
;;
"--ami-users"):
Expand Down Expand Up @@ -152,6 +153,10 @@ while [ $# -gt 0 ]; do
ARCH="$2"
shift 2
;;
"--ec2-instance-type")
yaronkaikov marked this conversation as resolved.
Show resolved Hide resolved
INSTANCE_TYPE="$2"
shift 2
;;
*)
echo "ERROR: Illegal option: $1"
print_usage
Expand Down Expand Up @@ -270,11 +275,15 @@ if [ "$TARGET" = "aws" ]; then
case "$arch" in
"x86_64")
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd/ubuntu-jammy-22.04-amd64*"
INSTANCE_TYPE="c4.xlarge"
if [ -z "$INSTANCE_TYPE" ]; then
INSTANCE_TYPE="c4.xlarge"
fi
;;
"aarch64")
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd/ubuntu-jammy-22.04-arm64*"
INSTANCE_TYPE="im4gn.2xlarge"
if [ -z "$INSTANCE_TYPE" ]; then
INSTANCE_TYPE="im4gn.2xlarge"
fi
;;
*)
echo "Unsupported architecture: $arch"
Expand Down