Each resource object has a special meta attribute, which is a Python type that contains information about the service, access to a low-level client, and sometimes lazy loaded cached resource attributes. You can access it like this:
client = ec2.meta.client response = client.reboot_instances(InstanceIds=[...])
This is especially useful if you created a resource using custom parameters that you do not want to track later:
ec2 = boto3.resource('ec2', region_name='us-west-2')
As always, be sure to check out the official documentation. Note : this interface is changed in boto3 # 45 . meta used to be a dict .
source share