在aws ecs fargate中使用cloudformation创建服务“没有稳定”

时间:2018-04-07 18:00:48

标签: amazon-cloudformation amazon-ecs

AWSTemplateFormatVersion: "2010-09-09"
Description: Not Have Any Idea
Parameters:
  Service:
    Description: Service Name
    Type: String
  Cluster:
    Description: Cluster Name
    Type: String
  TaskDefinition:
    Description: TaskDefinition Name
    Type: String
  securitygroup:
    Description: securitygroup
    Type: AWS::EC2::SecurityGroup::Id
  SubnetId:
    Type: List<AWS::EC2::Subnet::Id>
    Description: Select at two subnets in your selected VPC.
Resources:
  sernginx:
    Type: "AWS::ECS::Service"
    Properties:
      ServiceName:
        Ref: Service
      LaunchType: "FARGATE"
      DesiredCount: 1
      Cluster:
        Ref: Cluster
      TaskDefinition:
        Ref: TaskDefinition
      DeploymentConfiguration:
        MaximumPercent: 200
        MinimumHealthyPercent: 70
      NetworkConfiguration:
        AwsvpcConfiguration:
          AssignPublicIp: ENABLED
          SecurityGroups:
          - Ref: securitygroup
          Subnets:
            Ref: SubnetId

我正在使用此代码创建aws ecs服务fargate

我收到ROLLBACK_COMPLETE状态,并显示错误消息

服务arn:aws:ecs:us-east-1:439138162442:service / yuiyiuyiu没有稳定

enter image description here

1 个答案:

答案 0 :(得分:0)

我已经使用这种模板来创建fargate任务。

  

AWSTemplateFormatVersion: '2010-09-09' Description: Docker Core App service Parameters: EnvironmentName: Type: String Default: coreapp Description: A name for the environment that this cloudformation will be part of. ServiceName: Type: String Default: coreapi Description: A name for the service ImageUrl: Type: String Default: your_image_URI Description: The url of a docker image ContainerPort: Type: Number Default: 5000 Description: What port number the application inside the docker container ContainerCpu: Type: Number Default: 256 Description: How much CPU to give the container. ContainerMemory: Type: Number Default: 512 Description: How much memory in megabytes to give the container DesiredCount: Type: Number Default: 2 Description: How many copies of the service task to run Role: Type: String Default: "" Description: (Optional) An IAM role to give the service's containers Resources: Service: Type: AWS::ECS::Service Properties: ServiceName: !Ref 'ServiceName' Cluster: - coreapp LaunchType: FARGATE DeploymentConfiguration: MaximumPercent: 200 MinimumHealthyPercent: 75 DesiredCount: !Ref 'DesiredCount' NetworkConfiguration: AwsvpcConfiguration: AssignPublicIp: ENABLED SecurityGroups: - sg-483aa03e Subnets: - subnet-2ce41866 - subnet-ceefe5aa TaskDefinition: !Ref 'TaskDefinition'