In a path-style URL, the endpoint you use must match the region in which the bucket resides. For example, if your bucket is in the South America (Sao Paulo) region, you must use the http://s3-sa-east-1.amazonaws.com/bucket endpoint. If your bucket is in the US Standard region, you must use the http://s3.amazonaws.com/bucket endpoint.
There are two types url. However, the second method results in an error
http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html