Skip to content

Use an Existing Elastic IP

Hanwen edited this page Sep 17, 2021 · 3 revisions

Note: Starting with ParallelCluster 3.x, using an existing Elastic IP is supported without the need for customizing CloudFormation template. Please see ElasticIp parameter for details.

  1. Clone the repo:
$ git clone https://github.com/aws/aws-parallelcluster.git
$ cd aws-parallelcluster/
  1. Modify the template cloudformation/aws-parallelcluster.cfn.json to include a parameter:
"ElasticIpId": {
  "Description": "The Id of the elastic IP to associate with the master instance.",
  "Type": "String"
},
  1. Modify #L4568 to reference that parameter:
"AssociateEIP": {
  "Type": "AWS::EC2::EIPAssociation",
  "Properties": {
    "AllocationId": {
      "Ref": "ElasticIpId"
    },
    "NetworkInterfaceId": {
      "Ref": "MasterENI"
    }
  },
  "Condition": "MasterPublicIp"
},
  1. Remove MasterEIP Resource #L1921:

Remove this block:

"MasterEIP": {
  "Type": "AWS::EC2::EIP",
  "Properties": {
    "Domain": "vpc"
  },
  "Condition": "MasterPublicIp"
},
  1. Upload the template:
$ util/uploadTemplate.sh --bucket [your s3 bucket] --srcdir . --region [aws region]

Reference the custom template from your cluster's config:

[cluster your_cluster]
template_url = https://s3.amazonaws.com/seaam-pcluster/template/aws-parallelcluster.cfn.2.3.1.json
Clone this wiki locally