def attach_instance_volume(client: boto3.client, instance_id: str, volume_id: str, mount_point: str) -> AWSResponse: try: response = client.attach_volume(Device=mount_point, InstanceId=instance_id, VolumeId=volume_id) logger.debug('Attached volume %s to instance %s' % (volume_id, instance_id)) except ClientError as e: raise FailedActivity( 'Unable to attach volume %s to instance %s: %s' % (volume_id, instance_id, e.response['Error']['Message'])) return response
def attach_instance_volume( client: boto3.client, instance_id: str, volume_id: str, mount_point: str ) -> AWSResponse: try: response = client.attach_volume( Device=mount_point, InstanceId=instance_id, VolumeId=volume_id ) logger.debug(f"Attached volume {volume_id} to instance {instance_id}") except ClientError as e: raise FailedActivity( "Unable to attach volume %s to instance %s: %s" % (volume_id, instance_id, e.response["Error"]["Message"]) ) return response