Skip to content

Instantly share code, notes, and snippets.

@oivoodoo
Created May 3, 2017 17:09
Show Gist options
  • Save oivoodoo/74dd93016af47264497557cd266b44bf to your computer and use it in GitHub Desktop.
Save oivoodoo/74dd93016af47264497557cd266b44bf to your computer and use it in GitHub Desktop.
from boto3 import client
cluster_id = "<cluster-id>"
eip = "<ip>"
emrclient = client('emr', 'us-east-1')
master_instance =emrclient.list_instances(ClusterId=cluster_id, InstanceGroupTypes=['MASTER'])
master_ec2_id = master_instance['Instances'][0]['Ec2InstanceId']
ec2client = client('ec2', 'us-east-1')
ec2client.associate_address(InstanceId=master_ec2_id, PublicIp=eip)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment