简体   繁体   English

导出 ECS Fargate 容器的 TaskID 并稍后在 AWS CDK 代码中使用它

[英]Exporting TaskID of ECS Fargate container and use it later point in AWS CDK code

I am using CDK version 2 with typescript, I have a scenario where I want the value of TaskID from ECS Fargate Container to be part of another command.我正在使用带有 typescript 的 CDK 版本 2,我有一个场景,我希望 ECS Fargate Container 中的 TaskID 的值成为另一个命令的一部分。 I am using new ecs.Cluster and new ecs.FargateTaskDefinition to create the stack.我正在使用new ecs.Clusternew ecs.FargateTaskDefinition来创建堆栈。 Can someone tell me how I can export the value to use it later in code.有人可以告诉我如何导出该值以便稍后在代码中使用它。

This is not possible, because a task ID is not a static value.这是不可能的,因为任务 ID 不是静态值。 Tasks are launched (often more than one) and stopped, restarted, etc. The task ID changes all the time.任务被启动(通常不止一个)并停止、重新启动等。任务 ID 一直在变化。 You will not be able to get a single task ID from an ECS service in a reasonable way.您将无法以合理的方式从 ECS 服务获取单个任务 ID。

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

相关问题 AWS CDK EcsDeployAction 更新现有 Fargate 服务 - AWS CDK EcsDeployAction update existing Fargate Service 使用 AWS CDK 创建数据库实例后如何运行 Fargate 任务? - How to run Fargate task after database instance is created with AWS CDK? 从 AWS CDK 中的 Fargate 集群获取所有服务 - Get all Services from a Fargate Cluster in AWS CDK 如何引用由 ECS/Fargate 容器洞察创建的 CloudWatch 指标 - How to reference a CloudWatch metric created by container insights for ECS/Fargate AWS cdk deploy --all 创建 ECS 服务失败 - AWS cdk deploy --all fails to create ECS service 在使用 Node.js 连接到 S3 时,如何让我在 AWS Fargate 容器中运行的代码承担 IAM 角色? - How do I enable my code runing in a AWS Fargate container to assume an IAM role when connecting to S3 with Node.js? 在打字稿中处理 aws-cdk 中的异步代码 - Dealing with async code in the aws-cdk in typescript 如何使用 CDK 将 AWS ECS (ApplicationLoadBalancedFargateService) 私有 IP 连接到 RDS 安全组 - How to Connect AWS ECS (ApplicationLoadBalancedFargateService) Private IP to RDS Security Group Using CDK 在 AWS CDK 中使用 AWS SDK 的正确方法 - Correct way to use AWS SDK within AWS CDK CDK 中的 ECS 角色无法访问 RoleArn - RoleArn not accessible for ECS Role in CDK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM