9단계(선택 사항): 리소스 정리 - 아마존 퀀텀 레저 데이터베이스 (아마존QLDB)

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

9단계(선택 사항): 리소스 정리

중요

지원 종료 알림: 기존 고객은 2025년 7월 31일 지원이 종료될 QLDB 때까지 Amazon을 사용할 수 있습니다. 자세한 내용은 아마존 QLDB 원장을 Amazon Aurora SQL Postgre로 마이그레이션을 참조하십시오.

vehicle-registration 원장을 계속 사용할 수 있습니다. 그러나 더 이상 필요하지 않은 경우 삭제해야 합니다.

원장을 삭제하려면
  1. 다음 프로그램(DeleteLedger.java)을 컴파일하고 실행하여 vehicle-registration 원장 및 모든 콘텐츠를 삭제합니다.

    /* * 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; } }
    참고

    원장에 삭제 방지가 활성화되어 있는 경우 를 사용하여 원장을 삭제하려면 먼저 이를 비활성화해야 합니다. QLDB API

  2. 이전 단계에서 저널 데이터를 내보냈는데 더 이상 필요하지 않은 경우, Amazon S3 콘솔을 사용하여 S3 버킷을 삭제하세요.

    에서 Amazon S3 콘솔을 엽니다 https://console.aws.amazon.com/s3/.