AWS SDK 또는 SetVaultNotifications CLI와 함께 사용 - Amazon S3 Glacier

이 페이지는 저장소와 2012년부터 출시된 원본 REST API를 사용하는 S3 Glacier 서비스의 기존 고객만 이용할 수 있습니다.

아카이브 스토리지 솔루션을 찾고 있다면 Amazon S3의 S3 Glacier 스토리지 클래스, S3 Glacier 인스턴트 검색, S3 Glacier 플렉서블 검색 S3 Glacier Deep Archive를 사용하는 것이 좋습니다. 이러한 스토리지 옵션에 대한 자세한 내용은 Amazon S3 사용 설명서의 S3 Glacier 스토리지 클래스S3 Glacier 스토리지 클래스를 사용한 장기 데이터 스토리지를 참조하십시오. 이러한 스토리지 클래스는 Amazon S3 API를 사용하며, 모든 지역에서 사용할 수 있으며, Amazon S3 콘솔 내에서 관리할 수 있습니다. 스토리지 비용 분석, 스토리지 렌즈, 다중 암호화 옵션을 포함한 보안 기능 등과 같은 기능을 제공합니다.

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

AWS SDK 또는 SetVaultNotifications CLI와 함께 사용

다음 코드 예제는 SetVaultNotifications의 사용 방법을 보여줍니다.

작업 예제는 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 다음 코드 예제에서는 컨텍스트 내에서 이 작업을 확인할 수 있습니다.

CLI
AWS CLI

다음 명령은 my-vault라는 볼트에 대한 SNS 알림을 구성합니다.

aws glacier set-vault-notifications --account-id - --vault-name my-vault --vault-notification-config file://notificationconfig.json

notificationconfig.json은 게시할 SNS 주제와 이벤트를 지정하는 현재 폴더의 JSON 파일입니다.

{ "SNSTopic": "arn:aws:sns:us-west-2:0123456789012:my-vault", "Events": ["ArchiveRetrievalCompleted", "InventoryRetrievalCompleted"] }

Amazon Glacier에서는 작업을 수행할 때 계정 ID 인수가 필요하지만 하이픈을 사용하여 사용 중인 계정을 지정할 수 있습니다.

Python
SDK for Python(Boto3)
참고

자세한 내용은 에서 확인할 수 GitHub 있습니다. AWS 코드 예제 리포지토리에서 전체 예제를 찾고 설정 및 실행하는 방법을 배워보세요.

class GlacierWrapper: """Encapsulates Amazon S3 Glacier API operations.""" def __init__(self, glacier_resource): """ :param glacier_resource: A Boto3 Amazon S3 Glacier resource. """ self.glacier_resource = glacier_resource def set_notifications(self, vault, sns_topic_arn): """ Sets an Amazon Simple Notification Service (Amazon SNS) topic as a target for notifications. Amazon S3 Glacier publishes messages to this topic for the configured list of events. :param vault: The vault to set up to publish notifications. :param sns_topic_arn: The Amazon Resource Name (ARN) of the topic that receives notifications. :return: Data about the new notification configuration. """ try: notification = self.glacier_resource.Notification("-", vault.name) notification.set( vaultNotificationConfig={ "SNSTopic": sns_topic_arn, "Events": [ "ArchiveRetrievalCompleted", "InventoryRetrievalCompleted", ], } ) logger.info( "Notifications will be sent to %s for events %s from %s.", notification.sns_topic, notification.events, notification.vault_name, ) except ClientError: logger.exception( "Couldn't set notifications to %s on %s.", sns_topic_arn, vault.name ) raise else: return notification
  • API에 대한 자세한 내용은 파이썬용AWS SDK (Boto3) API 레퍼런스를 참조하십시오 SetVaultNotifications.

AWS SDK 개발자 가이드 및 코드 예제의 전체 목록은 을 참조하십시오. SDK와 함께 S3 글레이셔 사용 AWS 이 주제에는 시작하기에 대한 정보와 이전 SDK 버전에 대한 세부 정보도 포함되어 있습니다.