1111
1212export AWS_DEFAULT_REGION=$cfn_region
1313aws_region_long_name=$( python /usr/local/bin/aws-region.py $cfn_region )
14+ aws_region_long_name=${aws_region_long_name/ Europe/ EU}
1415
1516masterInstanceType=$( ec2-metadata -t | awk ' {print $2}' )
1617masterInstanceId=$( ec2-metadata -i | awk ' {print $2}' )
@@ -58,18 +59,26 @@ echo "master_node_cost $master_node_h_price" | curl --data-binary @- http://127.
5859
5960
6061# ###################### FSX #########################
61- fsx_size_gb=$( aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
62+ # fsx_size_gb=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
63+ # | jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
64+ # | awk -F "," '{print $3}')
65+ #
66+ # fsx_type=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
67+ # | jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
68+ # | awk -F "," '{print $9}')
69+ #
70+ # fsx_throughput=$(aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
71+ # | jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
72+ # | awk -F "," '{print $10}')
73+
74+ fsx_id=$( aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
6275 | jq -r ' .Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
63- | awk -F " ," ' {print $3}' )
76+ | awk -F " ," ' {print $2}' )
77+ fsx_summary=$( aws fsx describe-file-systems --region $cfn_region --file-system-ids $fsx_id )
78+ fsx_size_gb=$( echo $fsx_summary | jq -r ' .FileSystems[0].StorageCapacity' )
79+ fsx_type=$( echo $fsx_summary | jq -r ' .FileSystems[0].LustreConfiguration.DeploymentType' )
80+ fsx_throughput=$( echo $fsx_summary | jq -r ' .FileSystems[0].LustreConfiguration.PerUnitStorageThroughput' )
6481
65- fsx_type=$( aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
66- | jq -r ' .Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
67- | awk -F " ," ' {print $9}' )
68-
69- fsx_throughput=$( aws cloudformation describe-stacks --stack-name $stack_name --region $cfn_region \
70- | jq -r ' .Stacks[0].Parameters | map(select(.ParameterKey == "FSXOptions"))[0].ParameterValue' \
71- | awk -F " ," ' {print $10}' )
72-
7382if [[ $fsx_type = " SCRATCH_2" ]] || [[ $fsx_type = " SCRATCH_1" ]]; then
7483 fsx_cost_gb_month=$( aws pricing get-products \
7584 --region us-east-1 \
124133 ebs_volume_total_cost=$( echo " scale=2; $ebs_volume_total_cost + $ebs_volume_cost " | bc)
125134done
126135
127- echo " ebs_master_cost $ebs_volume_total_cost " | curl --data-binary @- http://127.0.0.1:9091/metrics/job/cost
136+ echo " ebs_master_cost $ebs_volume_total_cost " | curl --data-binary @- http://127.0.0.1:9091/metrics/job/cost
0 commit comments