Skip to content

Sagemaker always try to create default bucket, even the custom default_bucket is already exists #1990

@Basanti-xian

Description

@Basanti-xian

Describe the bug
Sagemaker session always try to create default bucket, even though I already given an existing customised bucket when init Sagemaker session.
“errorMessage”: “Your previous request to create the named bucket succeeded and you already own it.“
Also, it happens continuously every few seconds.

To reproduce

import boto3
import sagemaker
from sagemaker.estimator import Estimator

bucket = "bucket-that-exists"
boto_session = boto3.session.Session(region_name="ap-southeast-1")

ml_estimator = Estimator(
    image_uri = container,
    role = role,
    sagemaker_session = sagemaker.session.Session(boto_session, default_bucket=bucket),
    **config["train_model"]["estimator_config"]
)

Expected behavior

Sagemaker should check the provided bucket is already exist and stop creating new.
Screenshot 2020-11-12 at 5 20 56 PM

However, bucket.creation_date returns None even when the bucket exists, and trying to create it again.

Screenshots or logs
Events from cloudtrail:

“eventSource”: “s3.amazonaws.com”,
    “eventName”: “CreateBucket”,
    “awsRegion”: “ap-southeast-1",
    “sourceIPAddress”: “3.0.220.101",
    “userAgent”: “[Boto3/1.13.9 Python/3.8.5 Linux/4.14.198-152.320.amzn2.x86_64 exec-env/AWS_ECS_FARGATE Botocore/1.17.44 Resource]“,
    “errorCode”: “BucketAlreadyOwnedByYou”,
    “errorMessage”: “Your previous request to create the named bucket succeeded and you already own it.“,
    “requestParameters”: {
        “CreateBucketConfiguration”: {
            “LocationConstraint”: “ap-southeast-1",
            “xmlns”: “http://s3.amazonaws.com/doc/2006-03-01/”
        },
        “bucketName”: "bucket-that-exists",
        “Host”: xxx
    },

System information

  • SageMaker Python SDK version: 2.10.0
  • Python version: 3.8
  • CPU or GPU: CPU
  • Custom Docker image (Y/N): Y

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions