

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Integrasi AWS Health dengan sistem lain menggunakan API AWS Health
<a name="health-api"></a>

AWS Health adalah layanan RESTful web yang menggunakan HTTPS sebagai transportasi dan JSON sebagai format serialisasi pesan. Kode aplikasi Anda dapat membuat permintaan langsung ke API AWS Health . Bila Anda langsung menggunakan API REST, Anda harus menulis kode yang diperlukan untuk menandatangani dan autentikasi permintaan Anda. Untuk informasi selengkapnya tentang AWS Health operasi dan parameter, lihat [Referensi AWS Health API](https://docs.aws.amazon.com/health/latest/APIReference/).

**catatan**  
Anda harus memiliki paket AWS Business Support\$1, AWS Enterprise Support, atau AWS Unified Operations [AWS Dukungan](https://aws.amazon.com/premiumsupport/)untuk menggunakan API. AWS Health Jika Anda menggunakan paket Wilayah AWS yang tidak menawarkan salah satu AWS Dukungan paket ini, atau jika Anda belum beralih ke salah satu paket ini, Anda dapat menggunakan AWS Health API dengan paket Business, Enterprise On-Ramp, atau Enterprise Support. Jika Anda memanggil AWS Health API dari Akun AWS yang tidak terdaftar di salah satu paket ini, maka Anda menerima `SubscriptionRequiredException` kesalahan.

Anda dapat menggunakan AWS SDKs untuk membungkus panggilan AWS Health REST API, yang dapat menyederhanakan pengembangan aplikasi Anda. Anda menentukan AWS kredensyal Anda, dan pustaka ini menangani otentikasi dan penandatanganan permintaan untuk Anda.

AWS Health juga menyediakan AWS Health Dasbor Konsol Manajemen AWS yang dapat Anda gunakan untuk melihat dan mencari peristiwa dan entitas yang terpengaruh. Lihat [Memulai AWS Health Dashboard Anda](getting-started-health-dashboard.md).

**Topics**
+ [Menandatangani permintaan AWS Health API](#signing)
+ [Memilih titik akhir untuk permintaan AWS Health API](#endpoints)
+ [Demo: Mengambil tujuh hari terakhir data AWS Health acara secara terprogram](using-global-endpoints-demo.md)
+ [Tutorial: Menggunakan AWS Health API dengan contoh Java](code-sample-java.md)

## Menandatangani permintaan AWS Health API
<a name="signing"></a>

Saat Anda menggunakan AWS SDKs atau AWS Command Line Interface (AWS CLI) untuk membuat permintaan AWS, alat ini secara otomatis menandatangani permintaan untuk Anda dengan kunci akses yang Anda tentukan saat Anda mengonfigurasi alat. Misalnya, jika Anda menggunakan demo titik akhir ketersediaan tinggi sebelumnya, Anda tidak perlu menandatangani permintaan sendiri. AWS SDK untuk Java 

**Contoh kode Java**  
Untuk contoh selengkapnya tentang cara menggunakan AWS Health API dengan AWS SDK untuk Java, lihat [contoh kode](code-sample-java.md) ini.



Saat Anda mengajukan permintaan, kami sangat menyarankan agar Anda tidak menggunakan kredensyal akun AWS root Anda untuk akses reguler. AWS Health Anda dapat menggunakan kredensial untuk membuat pengguna IAM. Untuk informasi selengkapnya, lihat [Mengunci Kunci Akses Pengguna Root AWS Akun Anda](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials) di *Panduan Pengguna IAM*.

Jika Anda tidak menggunakan AWS SDKs atau AWS CLI, maka Anda harus menandatangani permintaan Anda sendiri. Kami menyarankan Anda menggunakan AWS Signature Version 4. Untuk informasi selengkapnya, lihat [Menandatangani Permintaan AWS API](https://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html) di bagian *Referensi Umum AWS*.

## Memilih titik akhir untuk permintaan AWS Health API
<a name="endpoints"></a>

 AWS Health API mengikuti arsitektur aplikasi Multi-region Arsitektur aplikasi dan memiliki dua titik akhir regional dalam konfigurasi aktif-pasif. Untuk mendukung failover DNS aktif-pasif, AWS Health menyediakan titik akhir tunggal, global. Anda dapat melakukan pencarian DNS di titik akhir global untuk menentukan titik akhir aktif dan Wilayah penandatanganan yang sesuai. AWS Ini membantu Anda mengetahui titik akhir mana yang akan digunakan dalam kode Anda, sehingga Anda bisa mendapatkan informasi terbaru dari AWS Health.

Saat Anda membuat permintaan ke titik akhir global, Anda harus menentukan kredensyal AWS akses Anda ke titik akhir regional yang Anda targetkan dan mengonfigurasi penandatanganan untuk Wilayah Anda. Jika tidak, autentikasi Anda mungkin gagal. Untuk informasi selengkapnya, lihat [Menandatangani permintaan AWS Health API](#signing).

Untuk permintaan IPv6 -only, sebaiknya lakukan pencarian DNS di titik akhir global untuk menentukan aktif Wilayah AWS dan kemudian memanggil titik akhir dual-stack yang IPv6 didukung untuk Wilayah tersebut.

Tabel berikut menggambarkan konfigurasi default.


****  

| Deskripsi | Penandatanganan Wilayah | Titik akhir | Protokol | 
| --- | --- | --- | --- | 
| Aktif |  us-east-1  |  health.us-east-1.amazonaws.com (IPv4-hanya) health.us-east-1.api.aws (dan didukung) IPv4 IPv6   | HTTPS | 
| Pasif |  us-east-2  |  health.us-east-2.amazonaws.com (IPv4-hanya) health.us-east-2.api.aws (dan didukung) IPv4 IPv6   | HTTPS | 
| Global |  us-east-1  Ini adalah Wilayah penandatanganan titik akhir aktif saat ini.   |  global.health.amazonaws.com  | HTTPS | 

Untuk menentukan apakah titik akhir adalah *titik akhir aktif*, lakukan pencarian DNS pada CNAME *titik akhir global*, lalu ekstrak Wilayah dari nama yang AWS diselesaikan.

**Example : Pencarian DNS pada titik akhir global**  
Perintah berikut melengkapi pencarian DNS pada titik akhir global.health.amazonaws.com. Perintah kemudian mengembalikan titik akhir Wilayah us-east-1. Output ini memberi tahu Anda titik akhir mana yang harus Anda gunakan. AWS Health  

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

**Tip**  
Endpoint aktif dan pasif mengembalikan AWS Health data. Namun, data terbaru AWS Health hanya tersedia dari titik akhir aktif. Data dari titik akhir pasif akhirnya akan konsisten dengan titik akhir aktif. Kami merekomendasikan Anda me-restart setiap alur kerja ketika titik akhir aktif berubah.

# Demo: Mengambil tujuh hari terakhir data AWS Health acara secara terprogram
<a name="using-global-endpoints-demo"></a>

Dalam contoh kode berikut, AWS Health gunakan pencarian DNS terhadap titik akhir global untuk menentukan titik akhir regional aktif dan Region penandatanganan. AWS Health menggunakan informasi ini untuk mengambil laporan dari tujuh hari terakhir data peristiwa. Kode memulai ulang alur kerja jika titik akhir aktif berubah. 

**Topics**
+ [Demo: Mengambil tujuh hari terakhir data AWS Health acara menggunakan Java](#using-the-java-sample-code)
+ [Demo: Mengambil tujuh hari terakhir data AWS Health acara menggunakan Python](#using-the-python-code)

## Demo: Mengambil tujuh hari terakhir data AWS Health acara menggunakan Java
<a name="using-the-java-sample-code"></a>

**Prasyarat**  
Anda harus menginstal [Gradle](https://docs.gradle.org/current/userguide/installation.html).

**Untuk menggunakan contoh Java**

1. Unduh [demo titik akhir ketersediaan AWS Health tinggi](https://github.com/aws/aws-health-tools/tree/master/high-availability-endpoint) dari GitHub.

1. Arahkan ke proyek demo direktori `high-availability-endpoint/java`.

1. Dalam jendela baris perintah, masukkan perintah berikut.

   ```
   gradle build
   ```

1. Masukkan perintah berikut untuk menentukan AWS kredensyal Anda.

   ```
   export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
   export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
   export AWS_SESSION_TOKEN="your-aws-token"
   ```

1. Masukkan perintah berikut untuk menjalankan demo.

   ```
   gradle run
   ```  
**Example : keluaran AWS Health acara**  

   Contoh kode mengembalikan AWS Health peristiwa terbaru dalam tujuh hari terakhir di AWS akun Anda. Dalam contoh berikut, output mencakup AWS Health acara untuk AWS Config layanan.

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

### Sumber daya Java
<a name="resources-for-the-java-code"></a>
+ Untuk informasi selengkapnya, lihat [Antarmuka HealthClient](https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/health/HealthClient.html) di *Referensi AWS SDK untuk Java API* dan [kode sumber](https://repo1.maven.org/maven2/software/amazon/awssdk/health/2.14.2/).
+ [Untuk informasi selengkapnya tentang pustaka yang digunakan dalam demo ini untuk pencarian DNS, lihat dnsjava di.](https://github.com/dnsjava/dnsjava) GitHub

## Demo: Mengambil tujuh hari terakhir data AWS Health acara menggunakan Python
<a name="using-the-python-code"></a>

**Prasyarat**  
Anda harus menginstal [Python 3](https://www.python.org/downloads/).

**Untuk menggunakan contoh Python**

1. Unduh [demo titik akhir ketersediaan AWS Health tinggi](https://github.com/aws/aws-health-tools/tree/master/high-availability-endpoint) dari GitHub.

1. Arahkan ke proyek demo direktori `high-availability-endpoint/python`.

1. Di jendela baris perintah, masukkan perintah berikut.

   ```
   pip3 install virtualenv 
   virtualenv -p python3 v-aws-health-env
   ```
**catatan**  
Untuk Python 3.3 dan selanjutnya, Anda dapat menggunakan modul `venv` bawaan untuk menciptakan lingkungan virtual, bukan memasang `virtualenv`. Untuk informasi lebih lanjut, lihat [venv - Penciptaan lingkungan virtual](https://docs.python.org/3/library/venv.html) di situs web Python.  

   ```
   python3 -m venv v-aws-health-env
   ```

1. Masukkan perintah berikut untuk mengaktifkan lingkungan virtual.

   ```
   source v-aws-health-env/bin/activate
   ```

1. Masukkan perintah berikut untuk menginstal dependensi.

   ```
   pip install -r requirements.txt
   ```

1. Masukkan perintah berikut untuk menentukan AWS kredensyal Anda.

   ```
   export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
   export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
   export AWS_SESSION_TOKEN="your-aws-token"
   ```

1. Masukkan perintah berikut untuk menjalankan demo.

   ```
   python3 main.py
   ```  
**Example : keluaran AWS Health acara**  

   Contoh kode mengembalikan AWS Health peristiwa terbaru dalam tujuh hari terakhir di AWS akun Anda. Output berikut mengembalikan AWS Health peristiwa untuk pemberitahuan AWS keamanan.

   ```
   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 Dukungan [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'}
   ```

1. Setelah selesai, masukkan perintah berikut untuk nonaktifkan mesin virtual.

   ```
   deactivate
   ```

### Sumber daya Python
<a name="resources-for-python-code-example"></a>
+ Untuk informasi lebih lanjut tentang `Health. Client`, lihat [Referensi API AWS SDK for Python (Boto3)](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/health.html#Health.Client).
+ [Untuk informasi selengkapnya tentang pustaka yang digunakan dalam demo ini untuk pencarian DNS, lihat toolkit [dnspython](https://dnspython.readthedocs.io/en/stable/) dan kode sumber aktif.](https://github.com/rthalley/dnspython/) GitHub

# Tutorial: Menggunakan AWS Health API dengan contoh Java
<a name="code-sample-java"></a>

Contoh kode Java berikut menunjukkan cara menginisialisasi AWS Health klien dan mengambil informasi tentang peristiwa dan entitas.

## Langkah 1: Inisialisasi kredensial
<a name="step-1"></a>

Kredensi yang valid diperlukan untuk berkomunikasi dengan API. AWS Health Anda dapat menggunakan key pair dari setiap pengguna IAM yang terkait dengan AWS akun tersebut.

Membuat dan menginisialisasi sebuah [AWSCredentials](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/AWSCredentials.html)instance:

```
AWSCredentials credentials = null;
try {
       credentials = new ProfileCredentialsProvider("default").getCredentials();
} catch (Exception e) {
throw new AmazonClientException(
   "Cannot load the credentials from the credential profiles file. "
   + "Please make sure that your credentials file is at the correct "
   + "location (/home/username/.aws/credentials), and is in valid format.", e);
}
```

## Langkah 2: Inisialisasi klien AWS Health API
<a name="step-2"></a>

Menggunakan objek kredensial diinisialisasi dari langkah sebelumnya untuk membuat klien AWS Health :

```
import com.amazonaws.services.health.AWSHealthClient;

AWSHealth awsHealthClient = new AWSHealthClient(credentials);
```

## Langkah 3: Gunakan operasi AWS Health API untuk mendapatkan informasi acara
<a name="step-3"></a>

**DescribeEvents**

```
import com.amazonaws.services.health.model.DescribeEventsRequest;
import com.amazonaws.services.health.model.DescribeEventsResult;
import com.amazonaws.services.health.model.Event;
import com.amazonaws.services.health.model.EventFilter;

DescribeEventsRequest request = new DescribeEventsRequest();

EventFilter filter = new EventFilter();
// Filter on any field from the supported AWS Health EventFilter model. 
// Here is an example for Region us-east-1 events from the EC2 service.
filter.setServices(singletonList("EC2"));
filter.setRegions(singletonList("us-east-1"));
request.setFilter(filter);

DescribeEventsResult response = awsHealthClient.describeEvents(request);
List<Event> resultEvents = response.getEvents();

Event currentEvent = null;
for (Event event : resultEvents) {
    // Display result event data; here is a subset.
    System.out.println(event.getArn());
    System.out.println(event.getService());
    System.out.println(event.getRegion());
    System.out.println(event.getAvailabilityZone());
    System.out.println(event.getStartTime());
    System.out.println(event.getEndTime());
 }
```

**DescribeEventAggregates**

```
import com.amazonaws.services.health.model.DescribeEventAggregatesRequest;
import com.amazonaws.services.health.model.DescribeEventAggregatesResult;
import com.amazonaws.services.health.model.EventAggregate;
import com.amazonaws.services.health.model.EventFilter;

DescribeEventAggregatesRequest request = new DescribeEventAggregatesRequest();
// set the aggregation field
request.setAggregateField("eventTypeCategory");

// filter more on result if needed
EventFilter filter = new EventFilter();
filter.setRegions(singleton("us-east-1"));
request.setFilter(filter);

DescribeEventAggregatesResult response = awsHealthClient.describeEventAggregates(request);

// print event count for each eventTypeCategory
for (EventAggregate aggregate: response.getEventAggregates()) {
    System.out.println("Event Category:" + aggregate.getAggregateValue());
    System.out.println("Event Count:" + aggregate.getCount());
 }
```

**DescribeEventDetails**

```
import com.amazonaws.services.health.model.DescribeEventDetailsRequest;
import com.amazonaws.services.health.model.DescribeEventDetailsResult;
import com.amazonaws.services.health.model.Event;
import com.amazonaws.services.health.model.EventDetails;


DescribeEventDetailsRequest describeEventDetailsRequest = new DescribeEventDetailsRequest();
// set event ARN and local value

describeEventDetailsRequest.setEventArns(singletonList("arn:aws:health:us-east-1::event/service/eventTypeCode/eventId"));
describeEventDetailsRequest.setLocale("en-US");
filter.setEventArns
DescribeEventDetailsResult describeEventDetailsResult = awsHealthClient.describeEventDetails(request);
EventDetails eventDetail = describeEventDetailsResult.getSuccessfulSet().get(0);

// check event-related fields
Event event = eventDetail.getEvent();
System.out.println(event.getService());
System.out.println(event.getRegion());
System.out.println(event.getAvailabilityZone());
System.out.println(event.getStartTime());
System.out.println(event.getEndTime());

// print out event description
System.out.println(eventDetail.getEventDescription().getLatestDescription());
```

**DescribeAffectedEntities**

```
import com.amazonaws.services.health.model.AffectedEntity;
import com.amazonaws.services.health.model.DateTimeRange;
import com.amazonaws.services.health.model.DescribeAffectedEntitiesRequest;
import com.amdescribeEventDetailsRequestazonaws.services.health.model.DescribeAffectedEntitiesResult;

DescribeAffectedEntitiesRequest request = new DescribeAffectedEntitiesRequest();
EntityFilter filter = new EntityFilter();

filter.setEventArns(singletonList("arn:aws:health:us-east-1::event/service/eventTypeCode/eventId"));

DescribeAffectedEntitiesResult response = awsHealthClient.describeAffectedEntities(request);

for (AffectedEntity affectedEntity: response.getEntities()) {
    System.out.println(affectedEntity.getEntityValue());
    System.out.println(affectedEntity.getAwsAccountId());
    System.out.println(affectedEntity.getEntityArn());
 }
```

**DescribeEntityAggregates**

```
import com.amazonaws.services.health.model.DescribeEntityAggregatesRequest;
import com.amazonaws.services.health.model.DescribeEntityAggregatesResult;
import com.amazonaws.services.health.model.EntityAggregate;

DescribeEntityAggregatesRequest request = new DescribeEntityAggregatesRequest();

request.setEventArns(singletonList("arn:aws:health:us-east-1::event/service/eventTypeCode/eventId"));

DescribeEntityAggregatesResult response = awsHealthClient.describeEntityAggregates(request);

for (EntityAggregate entityAggregate : response.getEntityAggregates()) {
    System.out.println(entityAggregate.getEventArn());
    System.out.println(entityAggregate.getCount());
 }
```