AWS ecs使用cloudwatch计划任务

时间:2018-06-10 13:59:20

标签: amazon-cloudformation amazon-cloudwatch amazon-ecs

我正在尝试使用cloudwatch创建计划任务。 我正在使用这个页面

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html

我看到的问题是当我正常运行任务然后要求

  1. VPC
  2. 子网
  3. Launchtype
  4. 但是当我使用cloudwatch目标时,它不会要求vpc,子网等等。为什么会这样?

1 个答案:

答案 0 :(得分:0)

CloudFormation尚未更新以容纳某些Fargate功能。如果您尝试从CloudFormation部署ECS任务时遇到错误, 请尝试使用命令行界面(aws events put-target),它允许您添加一个目标,其中包含启动类型和网络配置所需的ECS参数。
这是我如何配置ECS任务以从CLI而不是CloudFormation进行部署的示例:

  1.将vpc / subnet配置添加到变量#include <stdio.h> /* simple function to empty remainder of line in stdin */ void empty_stdin (void) { int c = getchar(); while (c != '\n' && c != EOF) c = getchar(); } int main (void) { int i = 4, x; double d = 4.0, y; char s[] = "Apple ", z[105]; scanf("%d",&x); scanf("%lf",&y); /* leaves '\n' as next char in stdin */ empty_stdin(); /* empty extraneous characters */ scanf("%104[^\n]",z); /* read up to 104 chars, \n, or EOF */ printf("%d\n",i+x); printf("%0.1lf\n",d+y); printf("%s %s\n",s,z); return 0; }

scanf
  1. 运行以下命令来部署您的任务,该任务将从上面声明的变量中获取vpc配置
NETWORK_CONFIGURATION