From 7f4be37090e13b1de85aa176a2055c620019cc8f Mon Sep 17 00:00:00 2001 From: Jordan Laser Date: Fri, 9 Feb 2024 14:36:56 -0700 Subject: [PATCH] Update cloud-infra.yaml comment out instance creation for now --- .github/workflows/cloud-infra.yaml | 37 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cloud-infra.yaml b/.github/workflows/cloud-infra.yaml index 21f6ab75..17596d42 100644 --- a/.github/workflows/cloud-infra.yaml +++ b/.github/workflows/cloud-infra.yaml @@ -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"