Paso 9 (opcional): limpiar recursos - Base de datos Amazon Quantum Ledger (AmazonQLDB)

Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.

Paso 9 (opcional): limpiar recursos

importante

Aviso de fin de soporte: los clientes actuales podrán usar Amazon QLDB hasta que finalice el soporte, el 31 de julio de 2025. Para obtener más información, consulte Migración de un Amazon QLDB Ledger a Amazon Aurora SQL Postgre.

Puede seguir utilizando el libro mayor vehicle-registration. Sin embargo, si ya no lo necesita, debe eliminarlo.

Para eliminar el libro mayor
  1. Compile y ejecute el siguiente programa (DeleteLedger.java) para eliminar el libro mayor vehicle-registration y todo su contenido.

    /* * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: MIT-0 * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package software.amazon.qldb.tutorial; import com.amazonaws.services.qldb.AmazonQLDB; import com.amazonaws.services.qldb.model.DeleteLedgerRequest; import com.amazonaws.services.qldb.model.DeleteLedgerResult; import com.amazonaws.services.qldb.model.ResourceNotFoundException; import com.amazonaws.services.qldb.model.UpdateLedgerRequest; import com.amazonaws.services.qldb.model.UpdateLedgerResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Delete a ledger. * * This code expects that you have AWS credentials setup per: * http://docs.aws.amazon.com/java-sdk/latest/developer-guide/setup-credentials.html */ public final class DeleteLedger { public static final Logger log = LoggerFactory.getLogger(DeleteLedger.class); public static final Long LEDGER_DELETION_POLL_PERIOD_MS = 20_000L; public static AmazonQLDB client = CreateLedger.getClient(); private DeleteLedger() { } public static void main(String... args) throws Exception { try { setDeletionProtection(Constants.LEDGER_NAME, false); delete(Constants.LEDGER_NAME); waitForDeleted(Constants.LEDGER_NAME); } catch (Exception e) { log.error("Unable to delete the ledger.", e); throw e; } } /** * Send a request to the QLDB database to delete the specified ledger. * * @param ledgerName * Name of the ledger to be deleted. * @return DeleteLedgerResult. */ public static DeleteLedgerResult delete(final String ledgerName) { log.info("Attempting to delete the ledger with name: {}...", ledgerName); DeleteLedgerRequest request = new DeleteLedgerRequest().withName(ledgerName); DeleteLedgerResult result = client.deleteLedger(request); log.info("Success."); return result; } /** * Wait for the ledger to be deleted. * * @param ledgerName * Name of the ledger being deleted. * @throws InterruptedException if thread is being interrupted. */ public static void waitForDeleted(final String ledgerName) throws InterruptedException { log.info("Waiting for the ledger to be deleted..."); while (true) { try { DescribeLedger.describe(ledgerName); log.info("The ledger is still being deleted. Please wait..."); Thread.sleep(LEDGER_DELETION_POLL_PERIOD_MS); } catch (ResourceNotFoundException ex) { log.info("Success. The ledger is deleted."); break; } } } public static UpdateLedgerResult setDeletionProtection(String ledgerName, boolean deletionProtection) { log.info("Let's set deletionProtection to {} for the ledger with name {}", deletionProtection, ledgerName); UpdateLedgerRequest request = new UpdateLedgerRequest() .withName(ledgerName) .withDeletionProtection(deletionProtection); UpdateLedgerResult result = client.updateLedger(request); log.info("Success. Ledger updated: {}", result); return result; } }
    nota

    Si la protección contra la eliminación está habilitada para su libro mayor, primero debe deshabilitarla antes de poder eliminar el libro mayor mediante el. QLDB API

  2. Si exportó los datos del diario en el paso anterior y ya no los necesita, utilice la consola de Amazon S3 para eliminar el bucket de S3.

    Abra la consola Amazon S3 en https://console.aws.amazon.com/s3/.