Etapa 9 (opcional): Limpar os recursos - Banco de dados Amazon Quantum Ledger (AmazonQLDB)

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

Etapa 9 (opcional): Limpar os recursos

Importante

Aviso de fim do suporte: os clientes existentes poderão usar a Amazon QLDB até o final do suporte em 31/07/2025. Para obter mais detalhes, consulte Migrar um Amazon QLDB Ledger para o Amazon Aurora Postgre. SQL

Você pode continuar usando o ledger vehicle-registration. No entanto, se não precisar mais dele, deverá excluí-lo.

Para excluir o ledger
  1. Compile e execute o programa (DeleteLedger.java) a seguir para excluir seu ledger vehicle-registration e todo o seu conteúdo.

    /* * 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

    Se a proteção contra exclusão estiver ativada para seu livro contábil, você deverá primeiro desativá-la antes de excluir o livro contábil usando o. QLDB API

  2. Se você exportou dados do diário na etapa anterior e não precisa mais deles, use o console do Amazon S3 para excluir seu bucket do S3.

    Abra o console do Amazon S3 em. https://console.aws.amazon.com/s3/