Skip to content

Commit f2a39e1

Browse files
committed
pushed minor changes
1 parent 9e15001 commit f2a39e1

File tree

9 files changed

+27
-11
lines changed

9 files changed

+27
-11
lines changed

de_provision_resources.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ get_aws_credentials() {
2323
echo "PERMANENT_BUCKET_NAME=${PERMANENT_BUCKET_NAME:-not set}"
2424
echo "ECR_REPOSITORY_NAME=${ECR_REPOSITORY_NAME:-not set}"
2525
echo "IMAGE_URI=${IMAGE_URI:-not set}"
26+
echo "KEY_PAIR_NAME=${KEY_PAIR_NAME:-not set}"
2627

2728
# Check if the user wants to change any variables
2829
if confirm_change "AWS_REGION"; then
@@ -45,6 +46,10 @@ get_aws_credentials() {
4546
read -p "Enter the Docker image URI: " IMAGE_URI
4647
fi
4748

49+
if confirm_change "KEY_PAIR_NAME"; then
50+
read -p "Enter the key pair name: " KEY_PAIR_NAME
51+
fi
52+
4853
# Save the environment variables to a file
4954
echo "Saving environment variables to env_vars.sh..."
5055
{
@@ -70,7 +75,7 @@ fi
7075
BASE_DIR="$(pwd)" # Get the current working directory
7176

7277
# Navigate to each directory and deprovision resources
73-
for dir in setup-s3-temp setup-s3-permanent setup-lambda setup-ecr setup-ecs-task-definition setup-ecs-cluster; do
78+
for dir in setup-s3-temp setup-s3-permanent setup-lambda setup-ecr setup-ecs-task-definition setup-ecs-cluster setup-ec2; do
7479
cd "$BASE_DIR/pulumi/$dir" # Use the path relative to the BASE_DIR
7580
pulumi down --yes
7681
cd "$BASE_DIR" # Go back to the base directory

provision_resources.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
echo "Let's set up your resources"
44
sleep 1
5+
rm -rf env_vars.sh
56

67
# Read AWS credentials
78
read -p "Enter your AWS Access Key ID: " AWS_ACCESS_KEY_ID
@@ -11,7 +12,7 @@ echo # For newline after entering secret key
1112
echo "Warning: You need to give proper permission to this IAM user."
1213

1314
# Export AWS credentials as environment variables
14-
export AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID"
15+
export AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID"
1516
export AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY"
1617

1718
# Ask for the AWS region
@@ -20,7 +21,7 @@ read -p "In which AWS region do you want to setup resources? (e.g., us-east-1):
2021
# Change directories and update region in Pulumi configurations
2122
cd pulumi
2223

23-
for dir in setup-s3-temp setup-s3-permanent setup-lambda setup-ecr setup-ecs-task-definition setup-ecs-cluster; do
24+
for dir in setup-s3-temp setup-s3-permanent setup-lambda setup-ecr setup-ecs-task-definition setup-ecs-cluster setup-ec2; do
2425
cd $dir
2526
pulumi config set aws:region "$AWS_REGION"
2627
cd ..
@@ -50,6 +51,15 @@ pulumi refresh --yes # Sync the state before deploying
5051
pulumi up --yes
5152
cd ..
5253

54+
# Ask for the key pair name for EC2 instance
55+
read -p "Enter the name of the EC2 key pair: " KEY_PAIR_NAME
56+
export KEY_PAIR_NAME="$KEY_PAIR_NAME"
57+
58+
cd setup-ec2
59+
pulumi refresh --yes # Sync the state before deploying
60+
pulumi up --yes
61+
cd ..
62+
5363
# Ask for and validate ECR repository name
5464
while true; do
5565
read -p "Enter a valid name for the ECR repository (lowercase, use - or _ if needed): " ECR_REPOSITORY_NAME
@@ -103,7 +113,7 @@ cd ..
103113
cd setup-ecs-cluster
104114
pulumi refresh --yes # Sync the state before deploying
105115
pulumi up --yes
106-
cd ..
116+
cd ../..
107117

108118
# Save the environment variables to a file
109119
echo "Saving environment variables to env_vars.sh..."
@@ -116,6 +126,7 @@ echo "Saving environment variables to env_vars.sh..."
116126
echo "export PERMANENT_BUCKET_NAME=\"${PERMANENT_BUCKET_NAME:-my-permanent-bucket}\""
117127
echo "export ECR_REPOSITORY_NAME=\"${ECR_REPOSITORY_NAME:-my-ecr-repo}\""
118128
echo "export IMAGE_URI=\"${IMAGE_URI:-your-image-uri}\""
129+
echo "export KEY_PAIR_NAME=\"${KEY_PAIR_NAME:-your-}\""
119130
} > env_vars.sh || { echo "Failed to write to env_vars.sh"; }
120131

121132
# Source the env_vars.shs

pulumi/setup-ec2/Pulumi.dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
config:
2-
aws:region: ap-south-1
2+
aws:region: eu-west-1

pulumi/setup-ecr/Pulumi.dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
config:
2-
aws:region: "us-east-1"
2+
aws:region: "eu-west-1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
config:
2-
aws:region: "ap-south-1"
2+
aws:region: "eu-west-1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
config:
2-
aws:region: "us-east-1"
2+
aws:region: "eu-west-1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
config:
2-
aws:region: "ap-south-1"
2+
aws:region: "eu-west-1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
config:
2-
aws:region: "us-east-1"
2+
aws:region: "eu-west-1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
config:
2-
aws:region: "us-east-1"
2+
aws:region: "eu-west-1"

0 commit comments

Comments
 (0)