Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Create default SG for Task Run and Service Create #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

senglin
Copy link

@senglin senglin commented Jun 1, 2020

Issue #, if available:

  1. Fargate CLI currently does not check if the default security groups exist. It polls for the fargate-default security group. For fresh AWS accounts, there is no such SG. This results in a nil being returned. The CLI continues down this path to register the task/service with the SG, resulting in the following error message
  2. To reproduce this error, go to the AWS Console -> EC2> Security groups. If fargate-default is available, select it and remove it.
  3. In a terminal window, do the following:
> fargate task run web --image nginx:latest -v
...
[!] Could not run ECS task
InvalidParameterException: security group cannot be blank.
        status code: 400, request id: ce47d313-0784-4dfa-8c1b-f359f02693b0

Description of changes:

  • Added SetDefaultSecurityGroupID() call to check for default security groups for run task and
    create service.
  • Run task and create service creates default security group if default
    security group does not exist.
  • Similar function in vpc_operation.go is refactored into EC2 client and
    shared with service_create.go and task_run.go.
  • Added console logs in EC2 client, service_create.go, task_run.go.
  • Unit tests for refactored code. Increased EC2 module code coverage by 10%.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

- Added SetDefaultSecurityGroupID call to check for default security groups for run task and
create service.
- Run task and create service creates default security group if default
security group does not exist.
- Similar function in vpc_operation.go is refactored into EC2 client and
shared with service_create.go and task_run.go.
- Added console logs in EC2 client, service_create.go, task_run.go.
- Unit tests for refactored code
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant