Skip to content

Commit 5698b00

Browse files
authored
removed pem key info
1 parent 6f342cd commit 5698b00

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

docs/image_builder.sh

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#!/bin/bash
22

33
read -p "Enter Docker image to pull (e.g., nginx:latest): " DOCKER_IMAGE
4-
read -p "Enter the name of your EC2 key pair (do not include .pem): " KEY_NAME
54

65
AMI_ID="ami-0e58b56aa4d64231b" #AMI could possibly need to be updated in the future
76
INSTANCE_TYPE="t2.micro"
87
SECURITY_GROUP_NAME="ec2-docker-sg"
98
INSTANCE_PROFILE_NAME="EC2InstanceECRAccessProfile"
109
REGION="us-east-1"
1110
VOLUME_SIZE=20
12-
KEY_FILE="${KEY_NAME}.pem"
1311

1412
AFTER_SECOND_SLASH=$(echo "$DOCKER_IMAGE" | cut -d'/' -f3-)
1513
REPO_AND_TAG="${AFTER_SECOND_SLASH##*/}"
@@ -174,28 +172,6 @@ fi
174172
echo "Waiting for IAM instance profile propagation..."
175173
sleep 5
176174

177-
echo "Creating key pair..."
178-
179-
KEY_OUTPUT=$(aws ec2 create-key-pair \
180-
--key-name "$KEY_NAME" \
181-
--query 'KeyMaterial' \
182-
--output text \
183-
--region "$REGION" 2>&1)
184-
185-
if [[ $? -ne 0 ]]; then
186-
if [[ "$KEY_OUTPUT" == *"InvalidKeyPair.Duplicate" ]]; then
187-
echo "Key pair '$KEYNAME' already created."
188-
exit 1
189-
fi
190-
else
191-
echo "$KEY_OUTPUT" > "$KEY_FILE"
192-
chmod 400 "$KEY_FILE"
193-
echo "Key pair created and saved to $KEY_FILE"
194-
fi
195-
196-
echo "Waiting for key propagation..."
197-
sleep 5
198-
199175
USER_SCRIPT=$(cat <<EOF
200176
#!/bin/bash
201177
set -e
@@ -251,5 +227,4 @@ aws ec2 wait instance-running --instance-ids "$INSTANCE_ID"
251227
PUBLIC_IP=$(aws ec2 describe-instances --instance-ids "$INSTANCE_ID" \
252228
--query "Reservations[0].Instances[0].PublicIpAddress" --output text)
253229

254-
echo "If you wish to login a pem key has been put in your working directory. The instance public IP is: $PUBLIC_IP"
255230
echo "It can take up to 15 minutes for an image to appear in your private repository."

0 commit comments

Comments
 (0)