Skip to content

Add support for Bottlerocket AMI in ECS deployment #33

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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: 17 additions & 0 deletions master_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ TEMPLATE_SKELETON_FILE="base_template_v2.json"
APP_IMAGE_NAME=""
DEPLOYCATEGORY=""
ECSCLI_ENVFILE="api.env"
bottlerocket_ami_id=$(fetch_bottlerocket_ami_id $AWS_REGION)

# Variables specific to EBS

Expand Down Expand Up @@ -131,6 +132,22 @@ configure_docker_private_login() {
aws s3 cp "s3://appirio-platform-$ENV_CONFIG/services/common/dockercfg" ~/.dockercfg
}

# Function to fetch the latest Bottlerocket AMI ID
fetch_bottlerocket_ami_id() {
local region=${1:-us-east-1} # Default to us-east-1 if no region is provided

BOTTLE_ROCKET_AMI_ID=$(aws ssm get-parameters --names /aws/service/bottlerocket/aws-ecs-1/latest/amazon-linux-2/recommended/image_id --region $region --query 'Parameters[0].[Value]' --output text)

if [ -z "$BOTTLE_ROCKET_AMI_ID" ]; then
log "Failed to fetch Bottlerocket AMI ID for region $region"
return 1
else
log "Fetched Bottlerocket AMI ID for region $region: $BOTTLE_ROCKET_AMI_ID"
echo $BOTTLE_ROCKET_AMI_ID
fi
}


# ECS Deployment Functions
ECS_push_ecr_image() {
echo "\n\n"
Expand Down