AWS Health API에 액세스 - AWS Health

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

AWS Health API에 액세스

AWS Health은(는) HTTPS를 전송으로, JSON을 메시지 직렬화 형식으로 사용하는 RESTful 웹 서비스입니다. 애플리케이션 코드는 AWS Health API로 직접 요청할 수 있습니다. REST API를 직접 사용하는 경우 요청에 서명하고 이를 인증하기 위해 필요한 코드를 작성해야 합니다. AWS Health 연산 및 매개변수에 대한 자세한 내용은 AWS Health API Reference를 참조하세요.

참고

AWS Health API를 사용하려면 AWS Support의 Business, Enterprise On-Ramp 또는 Enterprise Support 플랜이 있어야 합니다. Business, Enterprise On-Ramp, 또는 Enterprise Support 플랜을 보유하지 않은 AWS 계정에서 AWS Health API를 호출하면 SubscriptionRequiredException 오류가 발생합니다.

AWS SDK를 사용하여 AWS Health REST API 호출을 래핑할 수 있으므로 애플리케이션 개발을 간소화할 수 있습니다. AWS 자격 증명을 입력하면 이러한 라이브러리에서 인증 및 서명 요청을 처리합니다.

AWS Health은(는) 또한 AWS Management Console에서 이벤트 및 영향을 받는 엔티티를 보고 검색하는 데 사용할 수 있는 AWS Health 대시보드도 제공합니다. AWS Health 대시 보드 시작하기 – 계정 상태 섹션을 참조하세요.

엔드포인트

AWS Health API는 다중 리전 애플리케이션 아키텍처를 따르며 액티브-패시브 구성에 두 개의 리전 엔드포인트가 있습니다. 액티브-패시브 DNS 장애 조치를 지원하기 위해 AWS Health각 단일 글로벌 엔드포인트를 제공합니다. 글로벌 엔드포인트에서 DNS 검색을 수행하여 액티브 엔드포인트와 해당 서명 AWS 리전을 확인할 수 있습니다. 이렇게 하면 코드에 사용할 엔드포인트를 알 수 있어 AWS Health에서 최신 정보를 파악할 수 있습니다.

글로벌 엔드포인트에 요청할 때는 대상 리전 엔드포인트에 AWS 액세스 보안 인증 정보를 지정하고 해당 리전의 서명을 구성해야 합니다. 그렇지 않으면 인증이 실패할 수 있습니다. 자세한 내용은 AWS Health API 요청에 서명 섹션을 참조하세요.

다음 표는 기본 구성을 나타낸 것입니다.

설명 서명 리전 Endpoint 프로토콜
액티브

us-east-1

health.us-east-1.amazonaws.com

HTTPS
패시브

us-east-2

health.us-east-2.amazonaws.com

HTTPS
전 세계

us-east-1

참고

현재 액티브 엔드포인트의 서명 리전입니다.

global.health.amazonaws.com

HTTPS

엔드포인트가 액티브 엔드포인트인지 확인하려면 글로벌 엔드포인트 CNAME에서 DNS 검색을 수행한 다음 확인된 이름에서 AWS 리전을 추출합니다.

예 : 글로벌 엔드포인트에서 DNS 검색

다음 명령은global.health.amazonaws.com 엔드포인트에서 DNS 검색을 완료합니다. 그러면 이 명령은 us-east-1 리전 엔드포인트를 반환합니다. 이 출력은 AWS Health에 어느 엔드포인트를 사용해야 하는지 알려줍니다.

dig global.health.amazonaws.com | grep CNAME global.health.amazonaws.com. 10 IN CNAME health.us-east-1.amazonaws.com
작은 정보

액티브 엔드포인트와 패시브 엔드포인트 모두 AWS Health 데이터를 반환합니다. 하지만 최신 AWS Health 데이터는 액티브 엔드포인트에서만 사용할 수 있습니다. 패시브 엔드포인트의 데이터는 결국 액티브 엔드포인트와 일치하게 됩니다. 액티브 엔드포인트가 변경되면 모든 워크플로우를 다시 시작하는 것이 좋습니다.

고가용성 엔드포인트 데모 사용

다음 코드 예제에서는 AWS Health가 글로벌 엔드포인트에 대한 DNS 검색을 사용하여 액티브 리전 엔드포인트와 서명 리전을 결정합니다. 그런 다음 액티브 엔드포인트가 변경되면 코드가 워크플로우를 다시 시작합니다.

Java 데모 사용

전제 조건

Gradle을 설치해야 합니다.

Java 예제를 사용하려면
  1. GitHub에서 AWS Health 고가용성 엔드포인트 데모를 다운로드하세요.

  2. 데모 프로젝트 high-availability-endpoint/java 디렉터리로 이동합니다.

  3. 명령줄 창에 다음 명령을 입력합니다.

    gradle build
  4. 다음 명령을 입력하여 AWS 보안 인증 정보를 지정합니다.

    export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE" export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" export AWS_SESSION_TOKEN="your-aws-token"
  5. 다음 명령을 입력하여 데모를 실행합니다.

    gradle run
    예 : AWS Health 이벤트 출력

    코드 예제는 AWS 계정에서 지난 7일간의 최근 AWS Health 이벤트를 반환합니다. 다음 예제의 출력에는 AWS Config 서비스에 대한 AWS Health 이벤트가 포함됩니다.

    > Task :run [main] INFO aws.health.high.availability.endpoint.demo.HighAvailabilityV2Workflow - EventDetails(Event=Event(Arn=arn:aws:health:global::event/CONFIG/AWS_CONFIG_OPERATIONAL_NOTIFICATION/AWS_CONFIG_OPERATIONAL_NOTIFICATION_88a43e8a-e419-4ca7-9baa-56bcde4dba3, Service=CONFIG, EventTypeCode=AWS_CONFIG_OPERATIONAL_NOTIFICATION, EventTypeCategory=accountNotification, Region=global, StartTime=2020-09-11T02:55:49.899Z, LastUpdatedTime=2020-09-11T03:46:31.764Z, StatusCode=open, EventScopeCode=ACCOUNT_SPECIFIC), EventDescription=EventDescription(LatestDescription=As part of our ongoing efforts to optimize costs associated with recording changes related to certain ephemeral workloads, AWS Config is scheduled to release an update to relationships modeled within ConfigurationItems (CI) for 7 EC2 resource types on August 1, 2021. Examples of ephemeral workloads include changes to Amazon Elastic Compute Cloud (Amazon EC2) Spot Instances, Amazon Elastic MapReduce jobs, and Amazon EC2 Autoscaling. This update will optimize CI models for EC2 Instance, SecurityGroup, Network Interface, Subnet, VPC, VPN Gateway, and Customer Gateway resource types to record direct relationships and deprecate indirect relationships. A direct relationship is defined as a one-way relationship (A->B) between a resource (A) and another resource (B), and is typically derived from the Describe API response of resource (A). An indirect relationship, on the other hand, is a relationship that AWS Config infers (B->A), in order to create a bidirectional relationship. For example, EC2 instance -> Security Group is a direct relationship, since security groups are returned as part of the describe API response for an EC2 instance. But Security Group -> EC2 instance is an indirect relationship, since EC2 instances are not returned when describing an EC2 Security group. Until now, AWS Config has recorded both direct and indirect relationships. With the launch of Advanced queries in March 2019, indirect relationships can easily be answered by running Structured Query Language (SQL) queries such as: SELECT resourceId, resourceType WHERE resourceType ='AWS::EC2::Instance' AND relationships.resourceId = 'sg-234213' By deprecating indirect relationships, we can optimize the information contained within a Configuration Item while reducing AWS Config costs related to relationship changes. This is especially useful in case of ephemeral workloads where there is a high volume of configuration changes for EC2 resource types. Which resource relationships are being removed? Resource Type: Related Resource Type 1 AWS::EC2::CustomerGateway: AWS::VPN::Connection 2 AWS::EC2::Instance: AWS::EC2::EIP, AWS::EC2::RouteTable 3 AWS::EC2::NetworkInterface: AWS::EC2::EIP, AWS::EC2::RouteTable 4 AWS::EC2::SecurityGroup: AWS::EC2::Instance, AWS::EC2::NetworkInterface 5 AWS::EC2::Subnet: AWS::EC2::Instance, AWS::EC2::NetworkACL, AWS::EC2::NetworkInterface, AWS::EC2::RouteTable 6 AWS::EC2::VPC: AWS::EC2::Instance, AWS::EC2::InternetGateway, AWS::EC2::NetworkACL, AWS::EC2::NetworkInterface, AWS::EC2::RouteTable, AWS::EC2::Subnet, AWS::EC2::VPNGateway, AWS::EC2::SecurityGroup 7 AWS::EC2::VPNGateway: AWS::EC2::RouteTable, AWS::EC2::VPNConnection Alternate mechanism to retrieve this relationship information: The SelectResourceConfig API accepts a SQL SELECT command, performs the corresponding search, and returns resource configurations matching the properties. You can use this API to retrieve the same relationship information. For example, to retrieve the list of all EC2 Instances related to a particular VPC vpc-1234abc, you can use the following query: SELECT resourceId, resourceType WHERE resourceType ='AWS::EC2::Instance' AND relationships.resourceId = 'vpc-1234abc' If you have any questions regarding this deprecation plan, please contact AWS Support [1]. Additional sample queries to retrieve the relationship information for the resources listed above is provided in [2]. [1] https://aws.amazon.com/support [2] https://docs.aws.amazon.com/config/latest/developerguide/examplerelationshipqueries.html), EventMetadata={})

Java 리소스

  • 자세한 내용은 AWS SDK for Java API 참조Interface HealthClient소스 코드를 참조하세요.

  • 이 데모에서 DNS 검색에 사용되는 라이브러리에 대한 자세한 내용은 GitHub의 dnsjava를 참조하세요.

Python 데모 사용

전제 조건

Python 3을 설치해야 합니다.

Python 예제를 사용하려면
  1. GitHub에서 AWS Health 고가용성 엔드포인트 데모를 다운로드하세요.

  2. 데모 프로젝트 high-availability-endpoint/python 디렉터리로 이동합니다.

  3. 명령줄 창에 다음 명령을 입력합니다.

    pip3 install virtualenv virtualenv -p python3 v-aws-health-env
    참고

    Python 3.3 이상의 경우 virtualenv를 설치하는 대신 내장 venv 모듈을 사용하여 가상 환경을 만들 수 있습니다. 자세한 내용은 Python 웹 사이트의 venv - Creation of virtual environments를 참조하세요.

    python3 -m venv v-aws-health-env
  4. 다음 명령을 입력하여 가상 환경을 활성화합니다.

    source v-aws-health-env/bin/activate
  5. 다음 명령을 입력하여 존속성을 설치합니다.

    pip install -r requirements.txt
  6. 다음 명령을 입력하여 AWS 보안 인증 정보를 지정합니다.

    export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE" export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" export AWS_SESSION_TOKEN="your-aws-token"
  7. 다음 명령을 입력하여 데모를 실행합니다.

    python3 main.py
    예 : AWS Health 이벤트 출력

    코드 예제는 AWS 계정에서 지난 7일간의 최근 AWS Health 이벤트를 반환합니다. 다음 출력은 AWS 보안 알림에 대한 AWS Health 이벤트를 반환합니다.

    INFO:botocore.credentials:Found credentials in environment variables.
    INFO:root:Details: {'arn': 'arn:aws:health:global::event/SECURITY/AWS_SECURITY_NOTIFICATION/AWS_SECURITY_NOTIFICATION_0e35e47e-2247-47c4-a9a5-876544042721', 
    'service': 'SECURITY', 'eventTypeCode': 'AWS_SECURITY_NOTIFICATION', 'eventTypeCategory': 'accountNotification', 'region': 'global', 'startTime': datetime.datetime(2020, 8, 19, 23, 30, 42, 476000, 
    tzinfo=tzlocal()), 'lastUpdatedTime': datetime.datetime(2020, 8, 20, 20, 44, 9, 547000, tzinfo=tzlocal()), 'statusCode': 'open', 'eventScopeCode': 'PUBLIC'}, description: 
    {'latestDescription': 'This is the second notice regarding TLS requirements on FIPS endpoints.\n\nWe
    are in the process of updating all AWS Federal Information Processing Standard (FIPS) endpoints across all AWS regions 
    to Transport Layer Security (TLS) version 1.2 by March 31, 2021 . In order to avoid an interruption in service, we encourage you to act now, by ensuring that you connect to AWS FIPS endpoints at a TLS version of 1.2. 
    If your client applications fail to support TLS 1.2 it will result in connection failures when TLS versions below 1.2 are no longer supported.\n\nBetween now and March 31, 2021 AWS will remove TLS 1.0 and TLS 1.1 support from each FIPS endpoint where no connections below TLS 1.2 are detected over a 30-day period. 
    After March 31, 2021 we may deploy this change to all AWS FIPS endpoints, even if there continue
    to be customer connections detected at TLS versions below 1.2. \n\nWe will provide additional updates and reminders on the AWS Security Blog, with a ‘TLS’ tag [1]. If you need further guidance or assistance, please contact AWS Support [2] or your Technical Account Manager (TAM). 
    Additional information is below.\n\nHow can I identify clients that are connecting with TLS
    1.0/1.1?\nFor customers using S3 [3], Cloudfront [4] or Application Load Balancer [5] you can use
    your access logs to view the TLS connection information for these services, and identify client
    connections that are not at TLS 1.2. If you are using the AWS Developer Tools on your clients, 
    you can find information on how to properly configure your client’s TLS versions by visiting Tools to Build on AWS [7] or our associated AWS Security Blog has a link for each unique code language [7].\n\nWhat is Transport Layer Security (TLS)?\nTransport Layer Security (TLS Protocols) are cryptographic protocols designed to provide secure communication across a computer network 
    [6].\n\nWhat are AWS FIPS endpoints? \nAll AWS services offer Transport Layer Security (TLS) 1.2 encrypted endpoints that can be used for all API calls. Some AWS services also offer FIPS 140-2 endpoints [9] for customers that require use of FIPS validated cryptographic libraries. \n\n[1] https://aws.amazon.com/blogs/security/tag/tls/\n[2] https://aws.amazon.com/support\n[3] 
    https://docs.aws.amazon.com/AmazonS3/latest/dev/LogFormat.html\n[4] https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html\n[5] https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html\n[6] https://aws.amazon.com/tools\n[7] https://aws.amazon.com/blogs/security/tls-1-2-to-become-the-minimum-for-all-aws-fips-endpoints\n[8] 
    https://en.wikipedia.org/wiki/Transport_Layer_Security\n[9] https://aws.amazon.com/compliance/fips'}
  8. 완료한 후 다음 명령을 입력하여 가상 컴퓨터를 비활성화합니다.

    deactivate

Python 리소스

AWS Health API 요청에 서명

AWS SDK 또는 AWS Command Line Interface(AWS CLI)을(를) 사용하여 AWS에 요청을 하면 이러한 도구는 도구를 구성할 때 지정한 액세스 키로 요청에 자동으로 서명합니다. 예를 들어 이전 고가용성 엔드포인트 데모에 AWS SDK for Java를 사용하는 경우 요청에 서명할 필요가 없습니다.

Java 코드 예

AWS SDK for Java로 AWS Health API를 사용하는 방법에 대한 추가 예제는 이 예제 코드를 참조하세요.

요청할 때 AWS Health에 정기적으로 액세스하기 위해 AWS 루트 계정 자격 증명을 사용하지 않는 것이 좋습니다. 그 대신 IAM 사용자의 자격 증명을 사용하면 됩니다. 자세한 내용은 IAM 사용 설명서에서 AWS 계정 루트 사용자 액세스 키 잠그기를 참조하세요.

AWS SDK 또는 AWS CLI을(를) 사용하지 않는 경우 요청에 직접 서명해야 합니다. AWS 시그니처 버전 4를 사용하는 것이 좋습니다. 자세한 내용은 AWS 일반 참조AWS API 요청 서명을 참조하세요.