Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating a 'Target' for a cloudwatch event rule via cloudformation for a fargate launchtype task

I'm trying to create a scheduled task (CloudWatch Events Rule) in my CloudFormation Template that would have the following EcsParameters:

EcsParameters:
        LaunchType: FARGATE
        NetworkConfiguration: 
          AwsVpcConfiguration:
            AssignPublicIp: !Ref PublicIpAssignment
            SecurityGroups:
              - !Ref EcsSecurityGroups
            Subnets:
              - !Ref SubnetName
        TaskCount: 1
        TaskDefinitionArn: !Ref TaskDefinitionOne

My ECS CLuster is launched on Fargate and not EC2, and I do NOT have a service running (use case doesn't need a long running process, directly scheduling tasks from events rules.)

Whenever I run this template (with LaunchType and NetworkConfiguration) the stack creation fails, with this error:

Encountered unsupported property NetworkConfiguration


As an alternative, I also tried launching the scheduled task from AWS CLI, but it seems like the network config and launch type options are not available there either:

Parameter validation failed: Unknown parameter in Targets[0].EcsParameters: "LaunchType", must be one of: TaskDefinitionArn, TaskCount


According to this page on the AWS Documentation itself, I should be able to specify LaunchType and NetworkConfiguration in my EcsParameters section in Targets in Properties of the AWS::Events::Rule resource.

Is there anything I can try that might work?

like image 883
tanvi Avatar asked Sep 06 '18 16:09

tanvi


People also ask

How many total target S you can have for a single CloudWatch rule?

We quickly discovered that AWS limits each rule to only 5 targets. You can read more about AWS CloudWatch Event limits here.

Which of tasks can be done on AWS CloudFormation?

CloudFormation supports creating VPCs, subnets, gateways, route tables and network ACLs as well as creating resources such as elastic IPs, Amazon EC2 Instances, EC2 security groups, auto scaling groups, elastic load balancers, Amazon RDS database instances and Amazon RDS security groups in a VPC.

Can s3 trigger fargate?

Step 1 => Create your source s3 buckets where you would like data to be uploaded. These buckets become the source for triggering the downstream fargate ecs task.


1 Answers

Even though AWS hasn't updated the documentation by today (Jul.15, 2019) it's working as described by the initial poster.

like image 51
Sebastian Annies Avatar answered Sep 19 '22 18:09

Sebastian Annies