client.put_object(Bucket='example-space-name/example-folder/', # The path to the directory you want to upload the object to, starting with your Space name.
Key='hello-world.txt', # Object key, referenced whenever you want to access this file later.
Body=b'Hello, World!', # The object's contents.
ACL='private', # Defines Access-control List (ACL) permissions, such as private or public.
Metadata={ # Defines metadata tags.
'x-amz-meta-my-key': 'your-value'
}
)
If you attempt to use
Bucket='example-space-name/example-folder/'
You will receive a ParamValidationError:
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid bucket name "grb-backups/p2pooler-backups": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$" or be an ARN matching the regex "^arn:(aws).
:(s3|s3-object-lambda):[a-z\-0-9]
:[0-9]{12}:accesspoint[/:][a-zA-Z0-9\-.]{1,63}$|^arn:(aws).*:s3-outposts:[a-z\-0-9]+:[0-9]{12}:outpost[/:][a-zA-Z0-9\-]{1,63}[/:]accesspoint[/:][a-zA-Z0-9\-]{1,63}$"
Instead you should use:
Bucket="example-space-name",
Key="folder-path/filename.ext"