文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
DescribeEvents
搭配 CLI 使用
下列程式碼範例示範如何使用 DescribeEvents
。
- CLI
-
- AWS CLI
-
範例 1:列出 AWS 運作狀態事件
下列
describe-events
範例列出最近的 AWS 運作狀態事件。aws health describe-events \ --region
us-east-1
輸出:
{ "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" } ] }
如需詳細資訊,請參閱運作狀態使用者指南中的 AWS 個人運作狀態儀表板入門。 AWS
範例 2:依服務和事件狀態碼列出 AWS 運作狀態事件
下列
describe-events
範例列出事件狀態已關閉的 Amazon Elastic Compute Cloud (Amazon EC2) AWS 運作狀態事件。aws health describe-events \ --filter
"services=EC2,eventStatusCodes=closed"
輸出:
{ "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" } ] }
如需詳細資訊,請參閱運作狀態使用者指南中的 AWS 個人運作狀態儀表板入門。 AWS
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DescribeEvents
。
-
- PowerShell
-
- for PowerShell 工具
-
範例 1:此命令會從 AWS Personal Health Dashboard 傳回事件。使用者新增 -Region 參數,以查看美國東部 (維吉尼亞北部) 區域中服務可用的事件,但 -Filter_Region 參數篩選條件會針對記錄於歐盟 (倫敦) 和美國西部 (奧勒岡) 區域 (eu-west-2 和 us-west-2) 的事件進行篩選。-Filter_StartTime 參數會篩選事件可以開始的範圍,而 -Filter_EndTime 參數則會篩選事件可以結束的範圍。結果是 RDS 的排程維護事件,會在指定的 -Filter_StartTime 範圍內開始,並在排程的 -Filter_EndTime 範圍內結束。
Get-HLTHEvent -Region us-east-1 -Filter_Region "eu-west-2","us-west-2" -Filter_StartTime @{from="3/14/2019 6:30:00AM";to="3/15/2019 5:00:00PM"} -Filter_EndTime @{from="3/21/2019 7:00:00AM";to="3/21/2019 5:00:00PM"}
輸出:
Arn : arn:aws:health:us-west-2::event/RDS/AWS_RDS_HARDWARE_MAINTENANCE_SCHEDULED/AWS_RDS_HARDWARE_MAINTENANCE_SCHEDULED_USW2_20190314_20190321 AvailabilityZone : EndTime : 3/21/2019 2:00:00 PM EventTypeCategory : scheduledChange EventTypeCode : AWS_RDS_HARDWARE_MAINTENANCE_SCHEDULED LastUpdatedTime : 2/28/2019 2:26:07 PM Region : us-west-2 Service : RDS StartTime : 3/14/2019 2:00:00 PM StatusCode : open
-
如需 API 詳細資訊,請參閱 AWS Tools for PowerShell Cmdlet 參考中的 DescribeEvents。
-