Skip to content

Commit

Permalink
Update cloud-infra.yaml
Browse files Browse the repository at this point in the history
comment out instance creation for now
  • Loading branch information
JordanLaserGit committed Feb 9, 2024
1 parent 46123fc commit 7f4be37
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions .github/workflows/cloud-infra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,24 @@ jobs:
sudo apt-get install -y awscli
aws configure set aws_access_key_id ${{ secrets.aws_access_key_id }}
aws configure set aws_secret_access_key ${{ secrets.aws_secret_access_key }}
# uncomment when tested
# - name: Read JSON file
# run: |
# curl -L -O https://github.com/CIROH-UA/ngen-datastream/blob/main/cloud/AWS/datastream/execution_dailyrun.json
# INSTANCE_TYPE=$(jq -r '.isntance_paramters.InstanceType' ./execution_dailyrun.json)
# SECURITY_GRP=$(jq -r '.isntance_paramters.InstanceType' ./execution_dailyrun.json)
# ROLE=$(jq -r '.isntance_paramters.IamInstanceProfile' ./execution_dailyrun.json)
# REGION=$(jq -r '.region' execution_dailyrun.json)

- name: Read JSON file
run: |
curl -L -O https://github.com/CIROH-UA/ngen-datastream/blob/main/cloud/AWS/datastream/execution_dailyrun.json
INSTANCE_TYPE=$(jq -r '.isntance_paramters.InstanceType' ./execution_dailyrun.json)
SECURITY_GRP=$(jq -r '.isntance_paramters.InstanceType' ./execution_dailyrun.json)
REGION=$(jq -r '.region' execution_dailyrun.json)
- name: Create AMI
run: |
curl -L -O https://github.com/CIROH-UA/ngen-datastream/blob/main/cloud/AWS/startup_ec2.sh
output=$(aws ec2 run-instances --image-id resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 --instance-type $INSTANCE_TYPE region $REGION key-name datastream-github.pem security-group-ids $SECURITY_GRP --name ngen-datastream_$(env TZ=US/Eastern date +'%Y%m%d%H%M') ---user-data ./startup_ec2.sh)
instance_id=$(echo $output | jq -r '.Instances[0].InstanceId')
aws ec2 wait instance-running --instance-ids $instance_id
ami_output=$(aws ec2 create-image --instance-id $instance_id --name "My_AMI_Name" --region $REGION --description "My AMI Description")
ami_id=$(echo $ami_output | jq -r '.ImageId')
aws ec2 stop-instances --instance-ids $instance_id
echo "Created AMI: $AMI_ID"
# - name: Create AMI
# run: |
# curl -L -O https://github.com/CIROH-UA/ngen-datastream/blob/main/cloud/AWS/startup_ec2_gh.sh
# tag_str="ResourceType=instance,Tags=[{Key=Name,Value="ngen-datastream_$(env TZ=US/Eastern date +'%Y%m%d%H%M')"}]"
# output=$(aws ec2 run-instances --image-id resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 --instance-type $INSTANCE_TYPE --region $REGION --key-name datastream-github --security-group-ids $SECURITY_GRP --tag-specifications tag_str --user-data file://startup_ec2_gh.sh --iam-instance-profile Name="EC2ForcingProcessor")
# instance_id=$(echo $output | jq -r '.Instances[0].InstanceId')
# aws ec2 wait instance-running --instance-ids $instance_id
# ami_output=$(aws ec2 create-image --instance-id $instance_id --name "My_AMI_Name" --region $REGION --description "My AMI Description")
# ami_id=$(echo $ami_output | jq -r '.ImageId')
# aws ec2 stop-instances --instance-ids $instance_id
# echo "Created AMI: $AMI_ID"

0 comments on commit 7f4be37

Please sign in to comment.