繁体   English   中英

AWS CDK EcsDeployAction 更新现有 Fargate 服务

[英]AWS CDK EcsDeployAction update existing Fargate Service

我正在通过 AWS CDK 轻松部署 Fargate 服务。

现在我需要更新一个服务,例如一个任务图像。
我正在尝试通过使用 @aws-cdk/aws-codepipeline 和操作 EcsDeployAction 来完成此操作

我正在尝试导入和更新现有(以前部署的)fargate 服务,如下所示:

const pipeline = new codepipeline.Pipeline(this, 'MyPipeline')

// import an existing fargate service
const fargateService = ecs.FargateService.fromFargateServiceArn(
  this,
  "FargateService",
  "MyFargateServiceARN"
);

// Deploy a new version according to what 
const sourceStage = this.pipeline.addStage({
  stageName: 'Deploy',
  actions: [
    new codepipeline_actions.EcsDeployAction({
      actionName: "ECS-Service",
      service: fargateService,       <--- here the typescript error
      input: ...
    })
  ]
})

但这似乎不正确,因为我收到 typescript 错误:

Property 'cluster' is missing in type 'IFargateService' but required in type 'IBaseService'

任何想法?

类型不匹配。 EcsDeployActionProps 期望服务属性为IBaseService类型。 但它从fromFargateServiceArn获得了不兼容的IFargateService类型。

幸运的是,相关的static fromFargateServiceAttributes(scope, id, attrs)返回您正在寻找的兼容类型IBaseService

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM