Skip to content

(2024.08) Virtual desktops fail to mount read write S3 bucket with root bucket ARN and custom prefixing

Felipe Augusto Rangel edited this page Sep 11, 2024 · 1 revision

Issue

RES 2024.08 fails to mount read/write S3 buckets on to virtual desktops infrastructure (VDI) instance when using a root bucket ARN (i.e. arn:aws:s3:::example-bucket) and a custom prefix (project name or project name and user name).

Buckets configurations that are unaffected by this issue include:

  • read-only buckets
  • read/write buckets with a prefix as part of the bucket ARN (i.e. arn:aws:s3:::example-bucket/example-folder-prefix) and custom prefixing (project name or project name and user name)
  • read/write buckets with a root bucket ARN, but no custom prefixing

After provisioning a VDI instance, the specified mount directory for that S3 bucket will not have the bucket mounted. Although the mount directory on the VDI will be present, the directory will be empty and will not contain the current contents of the bucket. When writing a file to the directory via the terminal, the error Permission denied, unable to write a file will be thrown and its contents will not be uploaded to the respective S3 bucket.

Affected versions

This issue affects RES version 2024.08.

Mitigation

  1. Download patch.py and s3_mount_custom_prefix_fix.patch by replacing with the directory to download the patch script and patch file and with the name of your RES environment in the command below: a. The patch only applies to RES 2024.08. b. The patch script requires AWS CLI v2, Python 3.9.16 or above, and Boto3. c. Configure the AWS CLI for the account / region where RES is deployed, and make sure that you have S3 permissions to write to the bucket created by RES.
OUTPUT_DIRECTORY=<output-directory>
ENVIRONMENT_NAME=<environment-name>

mkdir -p ${OUTPUT_DIRECTORY}
curl https://research-engineering-studio-us-east-1.s3.amazonaws.com/releases/2024.08/patch_scripts/patch.py --output ${OUTPUT_DIRECTORY}/patch.py
curl https://research-engineering-studio-us-east-1.s3.amazonaws.com/releases/2024.08/patch_scripts/patches/s3_mount_custom_prefix_fix.patch --output ${OUTPUT_DIRECTORY}/s3_mount_custom_prefix_fix.patch
  1. Navigate to the directory where the patch script and patch file are downloaded. Run the following patch command:
python3 ${OUTPUT_DIRECTORY}/patch.py --environment-name ${ENVIRONMENT_NAME} --res-version 2024.08 --module virtual-desktop-controller --patch ${OUTPUT_DIRECTORY}/s3_mount_custom_prefix_fix.patch
  1. Terminate the Virtual Desktop Controller (vdc-controller) instance for your environment by replacing with the name of your RES environment in the commands below.
INSTANCE_ID=$(aws ec2 describe-instances \
    --filters \
    Name=tag:Name,Values=${ENVIRONMENT_NAME}-vdc-controller \
    Name=tag:res:EnvironmentName,Values=${ENVIRONMENT_NAME}\
    --query "Reservations[0].Instances[0].InstanceId" \
    --output text)
 
aws ec2 terminate-instances --instance-ids ${INSTANCE_ID}

Note: For private VPC setups, if not already done, for the <RES-EnvironmentName>-vdc-custom-credential-broker-lambda Lambda function add a Environment variable with name AWS_STS_REGIONAL_ENDPOINTS and value of regional to the Lambda function within the AWS Lambda console.

  1. After the target group starting with the name <RES-EnvironmentName>vdc-ext becomes healthy, new VDIs will need to be launched that will have the read/write S3 buckets with root bucket ARN and custom prefixing mounted correctly.

Clone this wiki locally

⌂ 换网址