Example:

1
2
3
img_url = d3aa8b1gak9v1d.cloudfront.net/assets/1/640d75f6-c607-4825-b23e-c4bd0e283c42/xwzxe02c76m3oxo00gil/mac-os-xspaces-options.png

bucket, file_path = img_url.split(/, 2)

This will populate bucket with d3aa8b1gak9v1d.cloudfront.net and put the rest of the string in file_path.

Full Details: https://ruby-doc.org/core-3.1.2/String.html#method-i-split