CreateBucket

CreateBucket #

Overview #

Creates a new bucket. To create a bucket you must have a valid IAM user. Not all names are valid names for a bucket name.

AWS API Reference: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html

For information on bucket naming restriction check https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html.


Method #

CREATEBUCKET

Import Parameters #

The request uses the following import parameters.

  • i_bucket_name (bucket in AWS) (Required)

    Name of the bucket to create.

  • i_region (Required)

    AWS Region of the Amazon S3 Bucket to be created.

  • i_x_amz_acl (x-amz-acl in AWS) (Required)

    The canned ACL to apply to the bucket

  • i_x_amz_bucket_obj_lock (x-amz-bucket-object-lock-enabled in AWS)

    Specifies whether you want S3 Object Lock to be enabled for the new bucket.

  • i_x_amz_grant_full_control (x-amz-grant-full-control in AWS)

    Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.

  • i_x_amz_grant_read (x-amz-grant-read in AWS)

    Allows grantee to list the objects in the bucket.

  • i_x_amz_grant_read_acp (x-amz-grant-read-acp in AWS)

    Allows grantee to read the bucket ACL.

  • i_x_amz_grant_write (x-amz-grant-write in AWS)

    Allows grantee to create, overwrite, and delete any object in the bucket.

  • i_x_amz_grant_write_acp (x-amz-grant-write-acp in AWS)

    Allows grantee to write the ACL for the applicable bucket.


Export Parameters #

This method use the following export parameters:

  • e_http_status

    HTTP Status code.

  • e_response_headers

    Returns information about the request in format Name/Value pair values.

  • e_response_content

    Response content in string format.


Example #

DATA: lo_s3               TYPE REF TO /lnkc/cl_sdk_aws_s3,
      lv_http_status      TYPE i,
      lt_response_headers TYPE tihttpnvp,
      lv_response_content TYPE string.

  TRY.
      CREATE OBJECT lo_s3
        EXPORTING
          i_user_name         = 'user_aws'
          i_access_key        = 'acces_key_value'
          i_secret_access_key = 'secret_acceskey_value'.
  ENDTRY.

 TRY.
    CALL METHOD lo_s3->createbucket
      EXPORTING
        i_bucket_name      = 'Bucket_name'
        i_region           = 'eu-west-1'
        i_x_amz_acl        = 'private'
      IMPORTING
        e_http_status      = lv_http_status
        e_response_headers = lt_response_headers
        e_response_content = lv_response_content.
 ENDTRY.