AWS Health exemplos usando AWS CLI - AWS Command Line Interface

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

AWS Health exemplos usando AWS CLI

Os exemplos de código a seguir mostram como realizar ações e implementar cenários comuns usando o AWS Command Line Interface with AWS Health.

Ações são trechos de código de programas maiores e devem ser executadas em contexto. Embora as ações mostrem como chamar funções de serviço individuais, você pode ver as ações no contexto em seus cenários relacionados.

Cada exemplo inclui um link para o código-fonte completo, onde você pode encontrar instruções sobre como configurar e executar o código no contexto.

Tópicos

Ações

O código de exemplo a seguir mostra como usar describe-affected-entities.

AWS CLI

Para listar as entidades afetadas por um evento AWS Health especificado

O describe-affected-entities exemplo a seguir lista as entidades afetadas pelo evento AWS Health especificado. Esse evento é uma notificação de cobrança para a AWS conta.

aws health describe-affected-entities \ --filter "eventArns=arn:aws:health:global::event/BILLING/AWS_BILLING_NOTIFICATION/AWS_BILLING_NOTIFICATION_6ce1d874-e995-40e2-99cd-EXAMPLE11145" \ --region us-east-1

Saída:

{ "entities": [ { "entityArn": "arn:aws:health:global:123456789012:entity/EXAMPLEimSMoULmWHpb", "eventArn": "arn:aws:health:global::event/BILLING/AWS_BILLING_NOTIFICATION/AWS_BILLING_NOTIFICATION_6ce1d874-e995-40e2-99cd-EXAMPLE11145", "entityValue": "AWS_ACCOUNT", "awsAccountId": "123456789012", "lastUpdatedTime": 1588356454.08 } ] }

Para obter mais informações, consulte Registro de eventos no AWS Health User Guide.

O código de exemplo a seguir mostra como usar describe-event-details.

AWS CLI

Para listar informações sobre um evento AWS de Saúde

O describe-event-details exemplo a seguir lista informações sobre o evento AWS Health especificado.

aws health describe-event-details \ --event-arns "arn:aws:health:us-east-1::event/EC2/AWS_EC2_OPERATIONAL_ISSUE/AWS_EC2_OPERATIONAL_ISSUE_VKTXI_EXAMPLE111" \ --region us-east-1

Saída:

{ "successfulSet": [ { "event": { "arn": "arn:aws:health:us-east-1::event/EC2/AWS_EC2_OPERATIONAL_ISSUE/AWS_EC2_OPERATIONAL_ISSUE_VKTXI_EXAMPLE111", "service": "EC2", "eventTypeCode": "AWS_EC2_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "us-east-1", "startTime": 1587462325.096, "endTime": 1587464204.774, "lastUpdatedTime": 1587464204.865, "statusCode": "closed" }, "eventDescription": { "latestDescription": "[RESOLVED] Increased API Error Rates and Latencies\n\n[02:45 AM PDT] We are investigating increased API error rates and latencies in the US-EAST-1 Region.\n\n[03:16 AM PDT] Between 2:10 AM and 2:59 AM PDT we experienced increased API error rates and latencies in the US-EAST-1 Region. The issue has been resolved and the service is operating normally." } } ], "failedSet": [] }

Para obter mais informações, consulte o painel Detalhes do evento no AWS Health User Guide.

O código de exemplo a seguir mostra como usar describe-events.

AWS CLI

Exemplo 1: Para listar eventos de AWS Health

O describe-events exemplo a seguir lista eventos recentes AWS de Health.

aws health describe-events \ --region us-east-1

Saída:

{ "events": [ { "arn": "arn:aws:health:us-west-1::event/ECS/AWS_ECS_OPERATIONAL_ISSUE/AWS_ECS_OPERATIONAL_ISSUE_KWQPY_EXAMPLE111", "service": "ECS", "eventTypeCode": "AWS_ECS_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "us-west-1", "startTime": 1589077890.53, "endTime": 1589086345.597, "lastUpdatedTime": 1589086345.905, "statusCode": "closed", "eventScopeCode": "PUBLIC" }, { "arn": "arn:aws:health:global::event/BILLING/AWS_BILLING_NOTIFICATION/AWS_BILLING_NOTIFICATION_6ce1d874-e995-40e2-99cd-EXAMPLE1118b", "service": "BILLING", "eventTypeCode": "AWS_BILLING_NOTIFICATION", "eventTypeCategory": "accountNotification", "region": "global", "startTime": 1588356000.0, "lastUpdatedTime": 1588356524.358, "statusCode": "open", "eventScopeCode": "ACCOUNT_SPECIFIC" }, { "arn": "arn:aws:health:us-west-2::event/CLOUDFORMATION/AWS_CLOUDFORMATION_OPERATIONAL_ISSUE/AWS_CLOUDFORMATION_OPERATIONAL_ISSUE_OHTWY_EXAMPLE111", "service": "CLOUDFORMATION", "eventTypeCode": "AWS_CLOUDFORMATION_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "us-west-2", "startTime": 1588279630.761, "endTime": 1588284650.0, "lastUpdatedTime": 1588284691.941, "statusCode": "closed", "eventScopeCode": "PUBLIC" }, { "arn": "arn:aws:health:ap-northeast-1::event/LAMBDA/AWS_LAMBDA_OPERATIONAL_ISSUE/AWS_LAMBDA_OPERATIONAL_ISSUE_JZDND_EXAMPLE111", "service": "LAMBDA", "eventTypeCode": "AWS_LAMBDA_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "ap-northeast-1", "startTime": 1587379534.08, "endTime": 1587391771.0, "lastUpdatedTime": 1587395689.316, "statusCode": "closed", "eventScopeCode": "PUBLIC" }, { "arn": "arn:aws:health:us-east-1::event/EC2/AWS_EC2_OPERATIONAL_ISSUE/AWS_EC2_OPERATIONAL_ISSUE_COBXJ_EXAMPLE111", "service": "EC2", "eventTypeCode": "AWS_EC2_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "us-east-1", "startTime": 1586473044.284, "endTime": 1586479706.091, "lastUpdatedTime": 1586479706.153, "statusCode": "closed", "eventScopeCode": "PUBLIC" }, { "arn": "arn:aws:health:global::event/SECURITY/AWS_SECURITY_NOTIFICATION/AWS_SECURITY_NOTIFICATION_42007387-8129-42da-8c88-EXAMPLE11139", "service": "SECURITY", "eventTypeCode": "AWS_SECURITY_NOTIFICATION", "eventTypeCategory": "accountNotification", "region": "global", "startTime": 1585674000.0, "lastUpdatedTime": 1585674004.132, "statusCode": "open", "eventScopeCode": "PUBLIC" }, { "arn": "arn:aws:health:global::event/CLOUDFRONT/AWS_CLOUDFRONT_OPERATIONAL_ISSUE/AWS_CLOUDFRONT_OPERATIONAL_ISSUE_FRQXG_EXAMPLE111", "service": "CLOUDFRONT", "eventTypeCode": "AWS_CLOUDFRONT_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "global", "startTime": 1585610898.589, "endTime": 1585617671.0, "lastUpdatedTime": 1585620638.869, "statusCode": "closed", "eventScopeCode": "PUBLIC" }, { "arn": "arn:aws:health:us-east-1::event/SES/AWS_SES_OPERATIONAL_ISSUE/AWS_SES_OPERATIONAL_ISSUE_URNDF_EXAMPLE111", "service": "SES", "eventTypeCode": "AWS_SES_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "us-east-1", "startTime": 1585342008.46, "endTime": 1585344017.0, "lastUpdatedTime": 1585344355.989, "statusCode": "closed", "eventScopeCode": "PUBLIC" }, { "arn": "arn:aws:health:global::event/IAM/AWS_IAM_OPERATIONAL_NOTIFICATION/AWS_IAM_OPERATIONAL_NOTIFICATION_b6771c34-6ecd-4aea-9d3e-EXAMPLE1117e", "service": "IAM", "eventTypeCode": "AWS_IAM_OPERATIONAL_NOTIFICATION", "eventTypeCategory": "accountNotification", "region": "global", "startTime": 1584978300.0, "lastUpdatedTime": 1584978553.572, "statusCode": "open", "eventScopeCode": "ACCOUNT_SPECIFIC" }, { "arn": "arn:aws:health:ap-southeast-2::event/EC2/AWS_EC2_OPERATIONAL_ISSUE/AWS_EC2_OPERATIONAL_ISSUE_HNGHE_EXAMPLE111", "service": "EC2", "eventTypeCode": "AWS_EC2_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "ap-southeast-2", "startTime": 1583881487.483, "endTime": 1583885056.785, "lastUpdatedTime": 1583885057.052, "statusCode": "closed", "eventScopeCode": "PUBLIC" } ] }

Para obter mais informações, consulte Introdução ao AWS Personal Health Dashboard no AWS Health User Guide.

Exemplo 2: Para listar eventos de AWS Health por serviço e código de status do evento

O describe-events exemplo a seguir lista eventos de AWS saúde para o Amazon Elastic Compute Cloud (AmazonEC2) em que o status do evento está fechado.

aws health describe-events \ --filter "services=EC2,eventStatusCodes=closed"

Saída:

{ "events": [ { "arn": "arn:aws:health:us-east-1::event/EC2/AWS_EC2_OPERATIONAL_ISSUE/AWS_EC2_OPERATIONAL_ISSUE_VKTXI_EXAMPLE111", "service": "EC2", "eventTypeCode": "AWS_EC2_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "us-east-1", "startTime": 1587462325.096, "endTime": 1587464204.774, "lastUpdatedTime": 1587464204.865, "statusCode": "closed", "eventScopeCode": "PUBLIC" }, { "arn": "arn:aws:health:us-east-1::event/EC2/AWS_EC2_OPERATIONAL_ISSUE/AWS_EC2_OPERATIONAL_ISSUE_COBXJ_EXAMPLE111", "service": "EC2", "eventTypeCode": "AWS_EC2_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "us-east-1", "startTime": 1586473044.284, "endTime": 1586479706.091, "lastUpdatedTime": 1586479706.153, "statusCode": "closed", "eventScopeCode": "PUBLIC" }, { "arn": "arn:aws:health:ap-southeast-2::event/EC2/AWS_EC2_OPERATIONAL_ISSUE/AWS_EC2_OPERATIONAL_ISSUE_HNGHE_EXAMPLE111", "service": "EC2", "eventTypeCode": "AWS_EC2_OPERATIONAL_ISSUE", "eventTypeCategory": "issue", "region": "ap-southeast-2", "startTime": 1583881487.483, "endTime": 1583885056.785, "lastUpdatedTime": 1583885057.052, "statusCode": "closed", "eventScopeCode": "PUBLIC" } ] }

Para obter mais informações, consulte Introdução ao AWS Personal Health Dashboard no AWS Health User Guide.

  • Para API obter detalhes, consulte DescribeEventsna Referência de AWS CLI Comandos.