How do I assign a static private IP address to the master node of my Amazon EMR cluster?
Last updated: 2021-07-08
I want to create a static private IP address and associate it with the master node of an Amazon EMR cluster using a bootstrap action.
- Confirm that your AWS Identity and Access Management (IAM) policy allows permissions for EMR_EC2_DefaultRole and ec2:AssignPrivateIpAddresses.
- Sign in to GitHub.
- Download the assign_private_ip.py script from AWS Labs.
- Save the script in an Amazon Simple Storage Service (Amazon S3) bucket.
- Specify the script as a custom bootstrap action while launching an Amazon EMR cluster. You can also run the script as an Amazon EMR step. The script requires an argument, which is a private IP address from the CIDR range of your subnet. The script attaches that private IP address to the network interface (eth0) of the master node. The script also configures the network settings to redirect all traffic from the secondary IP address to the primary IP address.
- To find the new IP address, open the Amazon Elastic Compute Cloud (Amazon EC2) console. Then, select the EC2 instance that's acting as the master node of the EMR cluster. The new IP address appears on the Description tab, in the Secondary private IPs field.