Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services aws elastic beanstalk无法创建缩放触发器失败,不允许AWSEBCloudwatchAlarmHigh空值_Amazon Web Services_Amazon Elastic Beanstalk_Cloudwatch Alarms - Fatal编程技术网

Amazon web services aws elastic beanstalk无法创建缩放触发器失败,不允许AWSEBCloudwatchAlarmHigh空值

Amazon web services aws elastic beanstalk无法创建缩放触发器失败,不允许AWSEBCloudwatchAlarmHigh空值,amazon-web-services,amazon-elastic-beanstalk,cloudwatch-alarms,Amazon Web Services,Amazon Elastic Beanstalk,Cloudwatch Alarms,当我试图指定一个缩放触发器时,它总是出错 Service:AmazonCloudFormation, Message:[/Resources/AWSEBCloudwatchAlarmHigh/Type/Dimensions/0/Value/Fn::GetAtt/0] 'null' values are not allowed in templates 我有一个保存的模板,我正在尝试添加 aws:autoscaling:trigger: BreachDuration: 5 Low

当我试图指定一个缩放触发器时,它总是出错

Service:AmazonCloudFormation, Message:[/Resources/AWSEBCloudwatchAlarmHigh/Type/Dimensions/0/Value/Fn::GetAtt/0] 'null' values are not allowed in templates
我有一个保存的模板,我正在尝试添加

aws:autoscaling:trigger:
    BreachDuration: 5
    LowerBreachScaleIncrement: -1
    LowerThreshold: 0.75
    MeasureName: Latency
    Period: 1
    EvaluationPeriods: 1
    Statistic: Average
    Unit: Seconds
    UpperBreachScaleIncrement: 2
    UpperThreshold: 1
所以我创建了它,没有这个,它创建了自动报警。我尝试使用浏览器更新此设置,但也失败,显示消息

Service:AmazonCloudFormation, Message:[/Resources/AWSEBCloudwatchAlarmHigh/Type/Dimensions/0/Value/Fn::GetAtt/0] 'null' values are not allowed in templates
这是我保存的模板

Platform:
  PlatformArn: arn:aws:elasticbeanstalk:eu-west-2::platform/Python 3.6 running on 64bit Amazon Linux/2.9.14
OptionSettings:
  aws:elasticbeanstalk:command:
    BatchSize: '30'
    BatchSizeType: Percentage
  AWSEBAutoScalingScaleUpPolicy.aws:autoscaling:trigger:
    UpperBreachScaleIncrement: '2'
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: domain.settings
    PYTHONPATH: $PYTHONPATH
    ALLOWED_CIDR_NETS: 10.0.0.0/16
    DATABASE_NAME: domainproductionplus
    DATABASE_HOST: domain-production-plus.coz8h02qupfe.eu-west-2.rds.amazonaws.com
    ENVIRONMENT: production
    DATABASE_PORT: '5432'
    EMAIL_BACKEND: django.core.mail.backends.console.EmailBackend
    DEBUG: '0'
    DATABASE_ENGINE: django.db.backends.postgresql_psycopg2
    REDIS_LOCATION: aws-co-qemfpydhs2ly.ubjsxm.0001.euw2.cache.amazonaws.com
    AWS_S3_REGION_NAME: eu-west-2
    ALLOWED_HOSTS: '*'
    VAPID_ADMIN_EMAIL: email@domain.com
    DATABASE_USER: domainprodplus
    AWS_STORAGE_BUCKET_NAME: domain-production-plus
    REDIS_LOCATION_X: domain-production-plus-001.domain-production-plus.ubjsxm.euw2.cache.amazonaws.com
    DATABASE_PASSWORD: '{{resolve:ssm:domain-api-production-plus-DATABASE_PASSWORD:1}}'
    HASHID_SALT: '{{resolve:ssm:domain-api-production-plus-HASHID_SALT:1}}'
    VAPID_PRIVATE_KEY: '{{resolve:ssm:domain-api-production-plus-VAPID_PRIVATE_KEY:1}}'
    VAPID_PUBLIC_KEY: '{{resolve:ssm:domain-api-production-plus-VAPID_PUBLIC_KEY:1}}'
    SECRET_KEY: '{{resolve:ssm:domain-api-production-plus-SECRET_KEY:1}}'
    AWS_SECRET_ACCESS_KEY: '{{resolve:ssm:domain-api-production-plus-AWS_SECRET_ACCESS_KEY:1}}'
  aws:autoscaling:updatepolicy:rollingupdate:
    RollingUpdateType: Health
    RollingUpdateEnabled: true
  aws:elb:policies:
    domainionDrainingEnabled: true
  aws:ec2:instances:
    InstanceTypes: t2.micro
  AWSEBAutoScalingGroup.aws:autoscaling:asg:
    Cooldown: '120'
    MaxSize: '6'
  aws:elasticbeanstalk:container:python:
    WSGIPath: domain/wsgi.py
    StaticFiles: /static/=www/static/
  aws:ec2:vpc:
    VPCId: vpc-0fddefb70e6c8b32a
    Subnets: subnet-04497865d7eb17b70
    AssociatePublicIpAddress: false
  aws:elasticbeanstalk:environment:process:default:
    DeregistrationDelay: 20
    HealthCheckInterval: 15
    HealthCheckPath: /app-version-updates
    HealthCheckTimeout: 5
    HealthyThresholdCount: 3
    MatcherHTTPCode: 200
    Port: 80
    Protocol: HTTP
    StickinessEnabled: false
    StickinessLBCookieDuration: 86400
    StickinessType: lb_cookie
    UnhealthyThresholdCount: 5
  aws:elbv2:listener:80:
    ListenerEnabled: true
    Protocol: HTTP
    Rules: domainapiproductionplus
  aws:elbv2:listener:443:
    ListenerEnabled: true
    SSLCertificateArns: arn:aws:acm:eu-west-2:799479065523:certificate/5fb4f19c-f377-4ef6-8a7a-9657832c0d17
    Protocol: HTTPS
    Rules: domainapiproductionplus
    SSLPolicy: ELBSecurityPolicy-TLS-1-2-2017-01
  aws:elbv2:listenerrule:domainapiproductionplus:
    HostHeaders: api-production-plus.hcidomain.digital
    PathPatterns: /*
    Priority: 2
    process: default
  aws:elb:loadbalancer:
    CrossZone: true
    ManagedSecurityGroup: sg-0ac0850967d4d2929
  aws:elbv2:loadbalancer:
    ManagedSecurityGroup: sg-0ac0850967d4d2929
    SharedLoadBalancer: arn:aws:elasticloadbalancing:eu-west-2:799479065523:loadbalancer/app/domain-production-plus/206b8390c82843a3
  aws:elasticbeanstalk:environment:
    ServiceRole: arn:aws:iam::799479065523:role/aws-elasticbeanstalk-service-role
    LoadBalancerType: application
    LoadBalancerIsShared: true
  aws:autoscaling:launchconfiguration:
    IamInstanceProfile: aws-elasticbeanstalk-ec2-role
    EC2KeyName: domain
    SecurityGroups: sg-0ac0850967d4d2929,sg-095397beca170840e,sg-02f17712a24784d64
    MonitoringInterval: 1 minute
  aws:autoscaling:trigger:
    BreachDuration: 5
    LowerBreachScaleIncrement: -1
    LowerThreshold: 0.75
    MeasureName: Latency
    Period: 1
    EvaluationPeriods: 1
    Statistic: Average
    Unit: Seconds
    UpperBreachScaleIncrement: 2
    UpperThreshold: 1
  aws:elasticbeanstalk:healthreporting:system:
    SystemType: enhanced
EnvironmentTier:
  Type: Standard
  Name: WebServer
AWSConfigurationTemplateVersion: 1.1.0.0
Tags:
  project: domain
  product: domain
我使用的是共享负载平衡器,这可能是问题所在吗?使用经典的负载平衡器,它可以很好地工作——设置自动缩放度量以使用延迟

要从cli创建环境,请运行

% eb create domain-api-production-plus --cfg domain-api-production-plus \
--cname domain-api-production-plus \
--elb-type application \
--shared-lb arn:aws:elasticloadbalancing:eu-west-2:799479065523:loadbalancer/app/domain-production-plus/206b8390c82843a3 \
--vpc \
--vpc.ec2subnets subnet-04497865d7eb17b70,subnet-032624d3e62d499f1 \
--vpc.elbsubnets subnet-0b3c3aa9b190a2546,subnet-05453d986413e8ae2 \
--vpc.id vpc-0fddefb70e6c8b32a \
--vpc.securitygroups sg-02f17712a24784d64,sg-095397beca170840e,sg-0ac0850967d4d2929 \
--tags project=domain,Name=domain-api-production-plus \
--service-role aws-elasticbeanstalk-service-role \
--region eu-west-2 \
--platform "arn:aws:elasticbeanstalk:eu-west-2::platform/Python 3.6 running on 64bit Amazon Linux/2.9.14" \
--keyname domain


Do you want to associate a public IP address? (Y/n): n
Do you want the load balancer to be public? (Select no for internal) (Y/n):
Creating application version archive "app-5aac-200929_084247".
Uploading Domain/app-5aac-200929_084247.zip to S3. This may take a while.
Upload Complete.
Environment details for: domain-api-production-plus
  Application name: Domain
  Region: eu-west-2
  Deployed Version: app-5aac-200929_084247
  Environment ID: e-tcwd2awzvs
  Platform: arn:aws:elasticbeanstalk:eu-west-2::platform/Python 3.6 running on 64bit Amazon Linux/2.9.14
  Tier: WebServer-Standard-1.0
  CNAME: domain-api-production-plus.eu-west-2.elasticbeanstalk.com
  Updated: 2020-09-29 07:42:50.765000+00:00
Printing Status:
2020-09-29 07:42:49    INFO    createEnvironment is starting.
2020-09-29 07:42:50    INFO    Using elasticbeanstalk-eu-west-2-799479065523 as Amazon S3 storage bucket for environment data.
2020-09-29 07:42:55    INFO    Created security group named: awseb-AWSEBManagedLBSecurityGroup-dw7edzemvt.
2020-09-29 07:43:13    INFO    Created target group named: arn:aws:elasticloadbalancing:eu-west-2:799479065523:targetgroup/awseb-domain--default-38qig/440561c9ab287e68
2020-09-29 07:43:13    INFO    Created security group named: sg-0e16398cbceab94d6
2020-09-29 07:43:14    INFO    Created Auto Scaling launch configuration named: awseb-e-tcwd2awzvs-stack-AWSEBAutoScalingLaunchConfiguration-1I6T492EE9NN1
2020-09-29 07:43:30    INFO    Created Load Balancer listener rule named: arn:aws:elasticloadbalancing:eu-west-2:799479065523:listener-rule/app/domain-production-plus/206b8390c82843a3/57e3715de5b24a02/0f045a9230df4191
2020-09-29 07:43:30    INFO    Created Load Balancer listener rule named: arn:aws:elasticloadbalancing:eu-west-2:799479065523:listener-rule/app/domain-production-plus/206b8390c82843a3/57e3715de5b24a02/f42374f1622dbd49
2020-09-29 07:43:30    INFO    Created Load Balancer listener rule named: arn:aws:elasticloadbalancing:eu-west-2:799479065523:listener-rule/app/domain-production-plus/206b8390c82843a3/457d5212b3cacc19/aa1f1cd2117f1290
2020-09-29 07:44:17    INFO    Created Auto Scaling group named: awseb-e-tcwd2awzvs-stack-AWSEBAutoScalingGroup-1I5GB63XJKP1Y
2020-09-29 07:44:17    INFO    Waiting for EC2 instances to launch. This may take a few minutes.
2020-09-29 07:44:17    INFO    Created Auto Scaling group policy named: arn:aws:autoscaling:eu-west-2:799479065523:scalingPolicy:664aebe1-ba1f-4d20-aed5-b44204b3a702:autoScalingGroupName/awseb-e-tcwd2awzvs-stack-AWSEBAutoScalingGroup-1I5GB63XJKP1Y:policyName/awseb-e-tcwd2awzvs-stack-AWSEBAutoScalingScaleDownPolicy-ZTC3D3FZQPZT
2020-09-29 07:44:17    INFO    Created Auto Scaling group policy named: arn:aws:autoscaling:eu-west-2:799479065523:scalingPolicy:c2431b1c-1efa-4927-a7ad-cdba75fa47ae:autoScalingGroupName/awseb-e-tcwd2awzvs-stack-AWSEBAutoScalingGroup-1I5GB63XJKP1Y:policyName/awseb-e-tcwd2awzvs-stack-AWSEBAutoScalingScaleUpPolicy-2MVWR52GOSTF
2020-09-29 07:44:32    INFO    Created CloudWatch alarm named: awseb-e-tcwd2awzvs-stack-AWSEBCloudwatchAlarmHigh-1OBABSCE98Y89
2020-09-29 07:44:32    INFO    Created CloudWatch alarm named: awseb-e-tcwd2awzvs-stack-AWSEBCloudwatchAlarmLow-UOJ9YBPCAIOH
2020-09-29 07:45:36    INFO    Successfully launched environment: domain-api-production-plus
更新

因此,我无法在beanstalk环境中找到TargetResponseTime

我使用的是共享负载平衡器,这可能是问题所在吗?使用经典的负载平衡器,它可以很好地工作-设置自动缩放度量以使用延迟

延迟
指标是CLB,而不是其他负载平衡器类型:

Latency:[HTTP listener]从负载平衡器向注册实例发送请求到该实例开始发送响应头所经过的总时间(以秒为单位)

对于ALB,最接近的度量:

TargetResponseTime:请求离开负载平衡器后,直到接收到来自目标的响应所经过的时间(以秒为单位)。这相当于访问日志中的target_processing_time字段

配置文件中混合了ALB和CLB设置。例如,
aws:elb:loadbalancer
用于CLB,而
aws:elbv2:loadbalancer
with
SharedLoadBalancer
仅用于ALB

您使用的是
延迟
,如上所述,该延迟仅适用于CLB。对于ALB,它应该是
TargetResponseTime


我无法验证在ASG中更改
MeasureName
是否能解决所有问题,但这肯定是造成问题的原因。

发布的模板没有
aws:autoscaling:trigger
。可能您实际尝试部署的模板中存在一些缩进问题?使用它进行了更新,包括在中。它们的触发器格式略有不同。不确定你的是否等同?我一直在使用这个指南。我跟着哪一个?如果可能,您可以尝试第二种格式。我不知道为什么有两个。可能它们是等效的。@shorif2000如果您没有
TargetResponseTime
,则表示您使用的是CLB,而不是ALB。但在配置文件中,您使用的是仅适用于ALB的
SharedLoadBalancer
。因此,它变得混淆了你的设置到底是什么。我认为这部分是它存在一些问题的原因。我正在尝试使用共享的ALB@shorif2000您是否正在尝试修改现有的EB env并从CLB更改为ALB?或者你正在从头开始创建一个新的?如果是后者,为什么在配置文件中有CLB相关设置?我试图将CLB移动到ALB