I have a variable which has the aws s3 url
s3://bucket_name/folder1/folder2/file1.json
I want to get the bucket_name in a variables and re
Here it is as a one-liner using regex:
import re s3_path = "s3://bucket/path/to/key" bucket, key = re.match(r"s3:\/\/(.+?)\/(.+)", s3_path).groups()