Configure ParallelCluster

Typically, to configure AWS ParallelCluster, you use the command pcluster configure and then provide the requested information, such as the AWS Region, Scheduler, and EC2 Instance Type. However, for this workshop you can take a shortcut by creating a basic configuration file, then customizing this file to include HPC specific options.

The following commands generate a new keypair, query the EC2 metadata to get the Subnet ID, VPC ID, and finally write a config to ~/.parallelcluster/config. You can always edit this config file to add and change configuration options.

IFACE=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/)
SUBNET_ID=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/${IFACE}/subnet-id)
VPC_ID=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/${IFACE}/vpc-id)
REGION=$(curl --silent http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/[a-z]$//')
AWS_REGION=$(curl --silent http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/[a-z]$//')
# generate a new key-pair
aws ec2 create-key-pair --key-name lab-3-your-key --query KeyMaterial --output text --region=${AWS_REGION} > ~/.ssh/lab-3-key
chmod 600 ~/.ssh/lab-3-key