Skip to content

/AWS1/IF_DYN=>CREATEGLOBALTABLE()

About CreateGlobalTable

Creates a global table from an existing table. A global table creates a replication relationship between two or more DynamoDB tables with the same table name in the provided Regions.

This documentation is for version 2017.11.29 (Legacy) of global tables, which should be avoided for new global tables. Customers should use Global Tables version 2019.11.21 (Current) when possible, because it provides greater flexibility, higher efficiency, and consumes less write capacity than 2017.11.29 (Legacy).

To determine which version you're using, see Determining the global table version you are using. To update existing global tables from version 2017.11.29 (Legacy) to version 2019.11.21 (Current), see Upgrading global tables.

If you want to add a new replica table to a global table, each of the following conditions must be true:

  • The table must have the same primary key as all of the other replicas.

  • The table must have the same name as all of the other replicas.

  • The table must have DynamoDB Streams enabled, with the stream containing both the new and the old images of the item.

  • None of the replica tables in the global table can contain any data.

If global secondary indexes are specified, then the following conditions must also be met:

  • The global secondary indexes must have the same name.

  • The global secondary indexes must have the same hash key and sort key (if present).

If local secondary indexes are specified, then the following conditions must also be met:

  • The local secondary indexes must have the same name.

  • The local secondary indexes must have the same hash key and sort key (if present).

Write capacity settings should be set consistently across your replica tables and secondary indexes. DynamoDB strongly recommends enabling auto scaling to manage the write capacity settings for all of your global tables replicas and indexes.

If you prefer to manage write capacity settings manually, you should provision equal replicated write capacity units to your replica tables. You should also provision equal replicated write capacity units to matching secondary indexes across your global table.

Method Signature

IMPORTING

Required arguments:

iv_globaltablename TYPE /AWS1/DYNTABLENAME /AWS1/DYNTABLENAME

The global table name.

it_replicationgroup TYPE /AWS1/CL_DYNREPLICA=>TT_REPLICALIST TT_REPLICALIST

The Regions where the global table needs to be created.

RETURNING

oo_output TYPE REF TO /aws1/cl_dyncreateglbtableout /AWS1/CL_DYNCREATEGLBTABLEOUT

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_dyn~createglobaltable(
  it_replicationgroup = VALUE /aws1/cl_dynreplica=>tt_replicalist(
    ( new /aws1/cl_dynreplica( |string| ) )
  )
  iv_globaltablename = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_globaltabledescription = lo_result->get_globaltabledescription( ).
  IF lo_globaltabledescription IS NOT INITIAL.
    LOOP AT lo_globaltabledescription->get_replicationgroup( ) into lo_row.
      lo_row_1 = lo_row.
      IF lo_row_1 IS NOT INITIAL.
        lv_regionname = lo_row_1->get_regionname( ).
        lv_replicastatus = lo_row_1->get_replicastatus( ).
        lv_replicastatusdescriptio = lo_row_1->get_replicastatusdescription( ).
        lv_replicastatuspercentpro = lo_row_1->get_rplstatuspercentprgss( ).
        lv_kmsmasterkeyid = lo_row_1->get_kmsmasterkeyid( ).
        lo_provisionedthroughputov = lo_row_1->get_provthroughputoverride( ).
        IF lo_provisionedthroughputov IS NOT INITIAL.
          lv_positivelongobject = lo_provisionedthroughputov->get_readcapacityunits( ).
        ENDIF.
        lo_ondemandthroughputoverr = lo_row_1->get_ondemandthruputoverride( ).
        IF lo_ondemandthroughputoverr IS NOT INITIAL.
          lv_longobject = lo_ondemandthroughputoverr->get_maxreadrequestunits( ).
        ENDIF.
        lo_tablewarmthroughputdesc = lo_row_1->get_warmthroughput( ).
        IF lo_tablewarmthroughputdesc IS NOT INITIAL.
          lv_positivelongobject = lo_tablewarmthroughputdesc->get_readunitspersecond( ).
          lv_positivelongobject = lo_tablewarmthroughputdesc->get_writeunitspersecond( ).
          lv_tablestatus = lo_tablewarmthroughputdesc->get_status( ).
        ENDIF.
        LOOP AT lo_row_1->get_globalsecondaryindexes( ) into lo_row_2.
          lo_row_3 = lo_row_2.
          IF lo_row_3 IS NOT INITIAL.
            lv_indexname = lo_row_3->get_indexname( ).
            lo_provisionedthroughputov = lo_row_3->get_provthroughputoverride( ).
            IF lo_provisionedthroughputov IS NOT INITIAL.
              lv_positivelongobject = lo_provisionedthroughputov->get_readcapacityunits( ).
            ENDIF.
            lo_ondemandthroughputoverr = lo_row_3->get_ondemandthruputoverride( ).
            IF lo_ondemandthroughputoverr IS NOT INITIAL.
              lv_longobject = lo_ondemandthroughputoverr->get_maxreadrequestunits( ).
            ENDIF.
            lo_globalsecondaryindexwar = lo_row_3->get_warmthroughput( ).
            IF lo_globalsecondaryindexwar IS NOT INITIAL.
              lv_positivelongobject = lo_globalsecondaryindexwar->get_readunitspersecond( ).
              lv_positivelongobject = lo_globalsecondaryindexwar->get_writeunitspersecond( ).
              lv_indexstatus = lo_globalsecondaryindexwar->get_status( ).
            ENDIF.
          ENDIF.
        ENDLOOP.
        lv_date = lo_row_1->get_rplinaccessibledatetime( ).
        lo_tableclasssummary = lo_row_1->get_replicatableclasssummary( ).
        IF lo_tableclasssummary IS NOT INITIAL.
          lv_tableclass = lo_tableclasssummary->get_tableclass( ).
          lv_date = lo_tableclasssummary->get_lastupdatedatetime( ).
        ENDIF.
      ENDIF.
    ENDLOOP.
    lv_globaltablearnstring = lo_globaltabledescription->get_globaltablearn( ).
    lv_date = lo_globaltabledescription->get_creationdatetime( ).
    lv_globaltablestatus = lo_globaltabledescription->get_globaltablestatus( ).
    lv_tablename = lo_globaltabledescription->get_globaltablename( ).
  ENDIF.
ENDIF.