Acceder al AWS Health API - AWS Health

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.

Acceder al AWS Health API

AWS Health es un servicio RESTful web que se utiliza HTTPS como formato de transporte y JSON serialización de mensajes. El código de su aplicación puede realizar solicitudes directamente al AWS Health API. Cuando lo utilice REST API directamente, deberá escribir el código necesario para firmar y autenticar sus solicitudes. Para obtener más información sobre las AWS Health operaciones y los parámetros, consulte la AWS Health APIReferencia.

nota

Debe tener un plan Business, Enterprise On-Ramp o Enterprise Support desde AWS Supportpara poder utilizar el AWS Health API. Si llamas AWS Health API desde una AWS cuenta que no tiene un plan Business, Enterprise On-Ramp o Enterprise Support, recibirás un SubscriptionRequiredException mensaje de error.

Puede usarlo AWS SDKs para cerrar las AWS Health REST API llamadas, lo que puede simplificar el desarrollo de su aplicación. Usted especifica sus AWS credenciales y estas bibliotecas se encargan de autenticar y firmar las solicitudes por usted.

AWS Health también incluye un AWS Health panel de control AWS Management Console que puede utilizar para ver y buscar eventos y entidades afectadas. Consulte Cómo empezar a usar tu AWS Health panel de control: el estado de tu cuenta.

puntos de conexión

AWS Health APISigue una arquitectura de aplicaciones multirregional, una arquitectura de y tiene dos puntos finales regionales en una configuración activo-pasiva. Para admitir la DNS conmutación por error activo-pasiva, proporciona un único punto final global. AWS Health Puede realizar una DNS búsqueda en el punto final global para determinar el punto final activo y la región de firma correspondiente. AWS Esto le ayuda a saber qué punto de conexión debe utilizar en su código, de modo que pueda obtener la información más reciente de AWS Health.

Al realizar una solicitud al punto de enlace global, debe especificar sus credenciales de AWS acceso al punto de enlace regional al que se dirige y configurar la firma para su región. De lo contrario, es posible que se produzca un error en la autenticación. Para obtener más información, consulte Firmar solicitudes AWS Health API.

En la siguiente tabla, se representa la configuración por defecto.

Descripción Región de firma Punto de conexión Protocolo
Activo

us-east-1

health.us-east-1.amazonaws.com

HTTPS
Pasivo

us-east-2

health.us-east-2.amazonaws.com

HTTPS
Global

us-east-1

nota

Esta es la región de firma del punto de conexión activo actual.

global.health.amazonaws.com

HTTPS

Para determinar si un punto final es el punto final activo, realice una DNS búsqueda en el punto final global yCNAME, a continuación, extraiga la AWS región del nombre resuelto.

ejemplo : DNS buscar en el punto final global

A continuación, el devuelve el punto de conexión de la región us-east-1. Este resultado te indica para qué punto final debes usar. AWS Health

dig global.health.amazonaws.com | grep CNAME global.health.amazonaws.com. 10 IN CNAME health.us-east-1.amazonaws.com
sugerencia

Tanto los puntos finales activos como los pasivos devuelven AWS Health datos. Sin embargo, los datos de AWS Health más recientes solo están disponibles en el punto de conexión activo. Los datos del punto de conexión pasivo serán coherentes con el punto de conexión activo. Le recomendamos que reinicie todos los flujos de trabajo cuando cambie el punto de conexión activo.

Uso de la demostración de punto de conexión de alta disponibilidad

En los siguientes ejemplos de código, AWS Health utiliza una DNS búsqueda en el punto final global para determinar el punto final regional activo y la región de firma. A continuación, el código reinicia el flujo de trabajo si cambia el punto de conexión activo.

Uso de demostración para Java

Requisito previo

Debe instalar Gradle.

Para usar el ejemplo de Java
  1. Descargue la demostración del punto final de AWS Health alta disponibilidad desde GitHub.

  2. Desplácese hasta el directorio del proyecto high-availability-endpoint/java de demostración.

  3. En una ventana con una línea de comandos, escriba el siguiente comando:

    gradle build
  4. Introduzca los siguientes comandos para especificar sus AWS credenciales.

    export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE" export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" export AWS_SESSION_TOKEN="your-aws-token"
  5. Ingrese el comando siguiente para ejecutar la demostración.

    gradle run
    ejemplo : salida AWS Health del evento

    El ejemplo de código devuelve el AWS Health evento reciente de los últimos siete días en tu AWS cuenta. En el siguiente ejemplo, el resultado incluye un AWS Health evento para el AWS Config servicio.

    > 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={})

Recursos de Java

  • Para obtener más información, consulte la interfaz HealthClient en la AWS SDK for Java APIreferencia y el código fuente.

  • Para obtener más información sobre la biblioteca utilizada en esta demostración para las DNS búsquedas, consulte dnsjava en. GitHub

Uso de la demostración de Python

Requisito previo

Debe instalar Python 3.

Para usar el ejemplo de Python
  1. Descargue la demostración de terminales de AWS Health alta disponibilidad desde. GitHub

  2. Desplácese hasta el directorio del proyecto high-availability-endpoint/python de demostración.

  3. En una ventana con una línea de comandos, escriba los siguientes comandos:

    pip3 install virtualenv virtualenv -p python3 v-aws-health-env
    nota

    En Python 3.3 y posteriores, puede utilizar el módulo venv integrado para crear un entorno virtual, en lugar de instalar virtualenv. Para obtener más información, consulte venv - Creation of virtual environments en el sitio web de Python.

    python3 -m venv v-aws-health-env
  4. Especifique el siguiente comando para activar el entorno virtual.

    source v-aws-health-env/bin/activate
  5. Ingrese el siguiente comando para instalar las dependencias.

    pip install -r requirements.txt
  6. Introduzca los siguientes comandos para especificar sus AWS credenciales.

    export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE" export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" export AWS_SESSION_TOKEN="your-aws-token"
  7. Ingrese el comando siguiente para ejecutar la demostración.

    python3 main.py
    ejemplo : salida AWS Health del evento

    El ejemplo de código devuelve el AWS Health evento reciente de los últimos siete días en tu AWS cuenta. El siguiente resultado devuelve un AWS Health evento para una notificación AWS de seguridad.

    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. Una vez que haya terminado, ingrese el siguiente comando para desactivar la máquina virtual.

    deactivate

Recursos de Python

Firmar solicitudes AWS Health API

Al utilizar AWS SDKs o AWS Command Line Interface (AWS CLI) para realizar solicitudes AWS, estas herramientas firman automáticamente las solicitudes por usted con la clave de acceso que especifique al configurar las herramientas. Por ejemplo, si las utiliza AWS SDK for Java para la anterior demostración de terminales de alta disponibilidad, no es necesario que firme las solicitudes usted mismo.

Ejemplos de código Java

Para ver más ejemplos sobre cómo utilizarlos AWS Health API con AWS SDK for Java, consulta este código de ejemplo.

Cuando realices solicitudes, te recomendamos encarecidamente que no utilices las credenciales de tu cuenta AWS raíz para acceder habitualmente a ellas AWS Health. Puedes usar las credenciales de un IAM usuario. Para obtener más información, consulte Bloquear las claves de acceso de los usuarios raíz de su AWS cuenta en la Guía del IAM usuario.

Si no utiliza las AWS SDKs o las AWS CLI, debe firmar las solicitudes usted mismo. Le recomendamos que utilice la versión 4 de AWS Signature. Para obtener más información, consulte Firmar AWS API solicitudes en Referencia general de AWS.