pcluster ssh perflab-yourname -i ~/.ssh/lab-4-key
REGION
and MY_SNS_TOPIC
variables are set. If not please set as follows:REGION=$(curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}')
MY_SNS_TOPIC=$(aws sns list-topics --query 'Topics[]' --output text --region $REGION | grep "slurm-job-completion")
cat > job-sns.sh << EOF
#!/bin/bash
#SBATCH --nodes=2
#SBATCH --time=10:00
hostname
sleep 5
aws sns publish --message "Your \${SLURM_JOB_NAME} with Job ID \${SLURM_JOB_ID} is complete" --topic $MY_SNS_TOPIC --region $REGION
EOF
sbatch job-sns.sh
Next, we will tear down the cluster and resources that you created as part of this lab.