コード例 #1
0
ファイル: actions.py プロジェクト: pravarag/chaostoolkit-aws
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
コード例 #2
0
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