Small fixups

This commit is contained in:
JustFiesta 2024-05-15 15:28:10 +02:00
parent 73519bc134
commit 610c82cd66
3 changed files with 6 additions and 3 deletions

View file

@ -107,7 +107,10 @@ echo "EC2 instance is now correctly configured."
# Allocate and associate public IP address with EC2 instance # Allocate and associate public IP address with EC2 instance
echo "Allocating and associating public IP address with EC2 instance..." echo "Allocating and associating public IP address with EC2 instance..."
PUBLIC_IP=$(aws ec2 allocate-address --domain vpc --region "$REGION" --output text) PUBLIC_IP=$(aws ec2 allocate-address --domain vpc --region "$REGION" --output text)
export PUBLIC_IP
aws ec2 associate-address --instance-id "$INSTANCE_ID" --public-ip "$PUBLIC_IP" --region "$REGION" aws ec2 associate-address --instance-id "$INSTANCE_ID" --public-ip "$PUBLIC_IP" --region "$REGION"
echo "Public IP address has been allocated and associated with EC2 instance: $PUBLIC_IP" echo "Public IP address has been allocated and associated with EC2 instance: $PUBLIC_IP"

View file

@ -3,7 +3,7 @@
# This script sets authenthicates and pulls docker image. Then runs it on host # This script sets authenthicates and pulls docker image. Then runs it on host
# Global data # Global data
source send_image_to_aws.sh source ./send_image_to_aws.sh
IMAGE_NAME="$ECR_NAME:latest" IMAGE_NAME="$ECR_NAME:latest"
@ -22,7 +22,7 @@ echo "Public IP address of EC2 instance: $PUBLIC_IP"
# Authorize ECR in docker # Authorize ECR in docker
echo "Getting authentication token for ECR..." echo "Getting authentication token for ECR..."
DOCKER_LOGIN_CMD=$(aws ecr get-login-password --region "$REGION" | docker login --username AWS --password-stdin "$ACCOUNT_ID".dkr.ecr."$REGION".amazonaws.com 2>&1) DOCKER_LOGIN_CMD=$(aws ecr get-login-password --region "$REGION" | docker login --username AWS --password-stdin "$AWS_ACCOUNT_ID".dkr.ecr."$REGION".amazonaws.com 2>&1)
if [[ $DOCKER_LOGIN_CMD == *"Login Succeeded"* ]]; then if [[ $DOCKER_LOGIN_CMD == *"Login Succeeded"* ]]; then
echo "Authentication with ECR successful." echo "Authentication with ECR successful."

View file

@ -5,7 +5,7 @@
# Note: docker is reqiured # Note: docker is reqiured
# Global data # Global data
source prepare_aws_enviroment.sh source ./prepare_aws_enviroment.sh
AWS_ACCOUNT_ID="" AWS_ACCOUNT_ID=""
DOCKERFILE_DIR="" DOCKERFILE_DIR=""