API 网关端点的 cloudwatch 警报。根据文档,我创建了下面的模板以及我阅读它的方式,如果存在 5xx 错误,该错误将大于“0”阈值,这应该触发。我不确定下面的“TreatMissingData”属性,这也指什么数据?还不确定“EvaluationPeriods”属性吗?有人可以解释一下吗?
loudAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
Namespace: AWS/ApiGateay
MetricName: 5XXError
Period: '60'
EvaluationPeriods: '1'
Threshold: 0
Statistic: Sum
ComparisonOperator: GreaterThanThreshold
TreatMissingData: ?????????
AlarmActions:
...
Run Code Online (Sandbox Code Playgroud) 我有以下一段代码,它利用 boto3 中的 list_objects_v2 。我收到错误 => keyError :“内容”。我假设如果我传递的文件名不存在,则会抛出此错误。
import boto3
s3_R = boto3.client('s3')
s3_b = s3_R.Bucket("MyBucket")
response = s3_R.list_objects_v2(Bucket=s3_b, Prefix='myfilename')
for obj in response['contents']:
file = obj['key']
print(file)
Run Code Online (Sandbox Code Playgroud)