Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . qldb ]

create-ledger

Description

Creates a new ledger in your AWS account.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  create-ledger
--name <value>
[--tags <value>]
--permissions-mode <value>
[--deletion-protection | --no-deletion-protection]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--name (string)

The name of the ledger that you want to create. The name must be unique among all of your ledgers in the current AWS Region.

--tags (map)

The key-value pairs to add as tags to the ledger that you want to create. Tag keys are case sensitive. Tag values are case sensitive and can be null.

Shorthand Syntax:

KeyName1=string,KeyName2=string

JSON Syntax:

{"string": "string"
  ...}

--permissions-mode (string)

The permissions mode to assign to the ledger that you want to create.

Possible values:

  • ALLOW_ALL

--deletion-protection | --no-deletion-protection (boolean)

The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this feature is enabled (true ) by default.

If deletion protection is enabled, you must first disable it before you can delete the ledger using the QLDB API or the AWS Command Line Interface (AWS CLI). You can disable it by calling the UpdateLedger operation to set the flag to false . The QLDB console disables deletion protection for you when you use it to delete a ledger.

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

Example 1: To create a ledger with default properties

The following create-ledger example creates a ledger with the name myExampleLedger and the permissions mode ALLOW_ALL. The optional parameter for deletion protection is not specified, so it defaults to true.

aws qldb create-ledger \
    --name myExampleLedger \
    --permissions-mode ALLOW_ALL

Output:

{
    "State": "CREATING",
    "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger",
    "DeletionProtection": true,
    "CreationDateTime": 1568839243.951,
    "Name": "myExampleLedger"
}

Example 2: To create a ledger with deletion protection disabled and with specified tags

The following create-ledger example creates a ledger with the name myExampleLedger2 and the permissions mode ALLOW_ALL. The deletion protection feature is disabled, and the specified tags are attached to the resource.

aws qldb create-ledger \
    --name myExampleLedger \
    --no-deletion-protection \
    --permissions-mode ALLOW_ALL \
    --tags IsTest=true,Domain=Test

Output:

{
    "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger2",
    "DeletionProtection": false,
    "CreationDateTime": 1568839543.557,
    "State": "CREATING",
    "Name": "myExampleLedger2"
}

For more information, see Basic Operations for Amazon QLDB Ledgers in the Amazon QLDB Developer Guide.

Output

Name -> (string)

The name of the ledger.

Arn -> (string)

The Amazon Resource Name (ARN) for the ledger.

State -> (string)

The current status of the ledger.

CreationDateTime -> (timestamp)

The date and time, in epoch time format, when the ledger was created. (Epoch time format is the number of seconds elapsed since 12:00:00 AM January 1, 1970 UTC.)

DeletionProtection -> (boolean)

The flag that prevents a ledger from being deleted by any user. If not provided on ledger creation, this feature is enabled (true ) by default.

If deletion protection is enabled, you must first disable it before you can delete the ledger using the QLDB API or the AWS Command Line Interface (AWS CLI). You can disable it by calling the UpdateLedger operation to set the flag to false . The QLDB console disables deletion protection for you when you use it to delete a ledger.