【问题标题】:Cloudformation service stuck without logCloudformation 服务卡住没有日志
【发布时间】:2021-05-13 00:54:13
【问题描述】:

我有一个最小的堆栈来创建一个带有侦听器的简单服务。侦听器首先创建并成功。该服务接下来会启动,但会卡在“CREATE_IN_PROGRESS”上。现在我看到了this issue on SO,但这有一个明显的失败原因。在我的情况下,Cloudtrail 日志简单地显示了启动和 10 分钟后(自定义超时)删除,但两者之间没有任何内容。 Cloudformation 仪表板事件也仅显示启动和此后的删除。

在此期间也不会创建服务。我通过转到服务并在那里有其他服务但不是我自己的服务来目视检查。

我已将 cloudformation 模板精简到裸露(即仅参考现有资源的侦听器和服务),但它仍然卡住。

除了通常的 cloudtrail 和 cloudformation 日志,我还能做些什么来识别问题?

[编辑] 这是我使用的模板。参数基于我当前的设置。

AWSTemplateFormatVersion: "2010-09-09"
Description: "The Script to configure the RDS services."
Parameters:
  ClusterNameARN:
    Default: "arn:aws:ecs:eu-central-1:<NR_HERE>:cluster/AmsCluster"
    Type: String
  StaLBARN:
    Default: "arn:aws:elasticloadbalancing:eu-central-1:<NR_HERE>:loadbalancer/app/StaPostgrestLoadBalancer/<ID_HERE>"
    Type: String
  StaTargetGroupARN:
    Default: "arn:aws:elasticloadbalancing:eu-central-1:<NR_HERE>:targetgroup/LBTargetGroupSta/<ID_HERE>"
    Type: String
  LoadBalancerSG:
    Type: 'AWS::EC2::SecurityGroup::Id'
  LoadBalancerSubnet1:
    Description: Subnet instance.
    Type: 'AWS::EC2::Subnet::Id'
  LoadBalancerSubnet2:
    Description: Subnet region B instance.
    Type: 'AWS::EC2::Subnet::Id'
  LoadBalancerSubnet3:
    Description: Subnet region for public.
    Type: 'AWS::EC2::Subnet::Id'
  StaTaskDefinitionARN:
    Default: "arn:aws:ecs:eu-central-1:<NR_HERE>:task-definition/RDSPostgrestFamily:2"
    Type: String
  CertificateARN:
    Default: "arn:aws:acm:eu-central-1:<NR_HERE>:certificate/<ID_HERE>"
    Type: String
Resources:
  LBListenerSta:
    Type: 'AWS::ElasticLoadBalancingV2::Listener'
    Properties:
      Certificates:
        - CertificateArn: !Ref CertificateARN
      DefaultActions:
        - Type: forward
          TargetGroupArn: !Ref StaTargetGroupARN
      LoadBalancerArn: !Ref StaLBARN
      Port: 443
      Protocol: HTTPS
  StaService:
    Type: 'AWS::ECS::Service'
    Properties:
      Cluster: !Ref ClusterNameARN
      DesiredCount: 2
      LaunchType: 'FARGATE'
      LoadBalancers:
        - ContainerName: 'Postgrest'
          ContainerPort: 3000
          TargetGroupArn: !Ref StaTargetGroupARN
      NetworkConfiguration:
        AwsvpcConfiguration:
          SecurityGroups:
            - !Ref LoadBalancerSG
          Subnets:
            - !Ref LoadBalancerSubnet1
            - !Ref LoadBalancerSubnet2
            - !Ref LoadBalancerSubnet3
      ServiceName: StaPostgrestService
      TaskDefinition: !Ref StaTaskDefinitionARN
    DependsOn:
     - LBListenerSta
Outputs:
  StaServices:
    Description: "The ARN of the service for the STA tasks."
    Value: !Ref StaService

【问题讨论】:

  • 你能展示一下模板以及卡在什么资源上吗?
  • 嗨@Marcin:我更新了问题并添加了模板。它卡在创建“Staservice”上。侦听器创建良好。
  • 能否请您转到ECS控制台,您的集群->服务->事件。它可能包含更多信息,您的 ecs 服务失败。
  • 啊,是的。现在我终于看到了一些东西。再次感谢@Marcin 的帮助。我有一个新的线索要调查。请将您的最后评论作为答案,因为它确实回答了原始问题。 (仅供参考:任务失败是因为无法承担角色。我想我可以自己解决这个问题。
  • 谢谢。已添加答案。

标签: amazon-web-services amazon-cloudformation


【解决方案1】:

基于 cmets。

问题在于StaService ECS 服务。要获得有关失败的可能原因的更多信息,可以访问:

ECS Console -> Cluster -> Service -> Events

基于此,Events 表明用于 ECS 的角色具有不正确的权限

【讨论】:

    猜你喜欢
    • 2014-02-21
    • 2021-03-12
    • 2018-05-05
    • 2019-09-09
    • 1970-01-01
    • 2020-04-10
    • 2016-07-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多