CodeDeploy How to set dynamic Capacity Provider

0

We are deploying a set of containers into various accounts using CodePipeline and CodeDeploy. Each account has a different capacity provider name so our question is how can we set up the AppSpec.yaml file to dynamically change the Capacity Provider depending on the account? Is there an environment variable that CodeDeploy can leverage as it does the <TASK_DEFINITION> value?

version: 0.0
Resources:
  - TargetService:
      Type: AWS::ECS::Service
      Properties:
        TaskDefinition: <TASK_DEFINITION>
        LoadBalancerInfo:
          ContainerName: 'name-of-container'
          ContainerPort: 80
         CapacityProviderStrategy:
           - Base: 1
             CapacityProvider: "how-do-i-set-this-dynamically-based-on-account-or-environment"
             Weight: 1
質問済み 2ヶ月前167ビュー
1回答
0

Hello.

I don't think capacity providers have a placeholder like <TASK_DEFINITION>.
Therefore, I thought that a workaround would be to use something like CodeBuild to rewrite the capacity provider name in appspec.yml during the build phase.
https://docs.aws.amazon.com/codebuild/latest/userguide/welcome.html

profile picture
エキスパート
回答済み 2ヶ月前
profile picture
エキスパート
レビュー済み 2ヶ月前
  • Thank you. But adding it on the Build would require us to change all the existing capacity providers to have the same name. What we are trying to do is make it dynamic. But to your point, it may just not be possible.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ