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.