Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CF template for freegeoip fargate stack #27259

Merged
merged 4 commits into from Feb 27, 2019
Merged

CF template for freegeoip fargate stack #27259

merged 4 commits into from Feb 27, 2019

Conversation

uponthesun
Copy link

I was able to create a stack from this template in the dev@ account and make a request to the ELB from an EC2 instance. Manual steps done beforehand:

  • Created a VPC stack (using slightly modified vpc template)
  • Created a IAM stack (using slightly modified iam template)
  • Built docker image from https://github.com/apilayer/freegeoip/
  • Created ECR repo and pushed image to it
  • "ecsTaskExecutionRole" had been created by the ECS wizard

WIP - minimal ELB stack, minimal fargate stack

WIP - first working version

Remove unneeded file
Copy link
Contributor

@wjordan wjordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Great starting point for configuring this service. Just added a few template syntax/style comments/suggestions, nothing too important.

VpcId: !ImportValue VPC
SecurityGroupIngress:
-
IpProtocol: 'tcp'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general you don't need to quote YAML values unless you're using special characters in a string or need a number/boolean to be cast as a string, I find it more readable to usually leave unnecessary quotes off.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, will update.

Tags:
-
Key: 'Name'
Value: !Join [' ', ['ECS', !Ref 'EcsClusterName', '-', 'ECS SecurityGroup']]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simplify older, hard-to-read !Join uses by replacing them with the newer !Sub intrinsic function and inline variable references:

!Sub "ECS ${EcsClusterName} - ECS SecurityGroup"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update

Properties:
LogGroupName: !Join ['-', [ECSLogGroup, !Ref 'AWS::StackName']]
RetentionInDays: 14
taskdefinition:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: consistent case-style for all Resources/Outputs (e.g., TaskDefinition)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Oddly enough this is from the AWS template snippets: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-ecs.html

Value: !Join [' ', ['ECS', !Ref 'EcsClusterName', '-', 'ECS SecurityGroup']]
-
Key: 'Description'
Value: !Join [' ', ['Created for ECS cluster', !Ref 'EcsClusterName']]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what benefit these 'description' tags are providing (they seem redundant with the Name tags) so can probably be removed (unless Description tag is significant in the console, I don't think it is).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both name and description show up in the console apparently. Agreed that the description is redundant, will remove.

Default: geocoder-default
EcsPort:
Type: String
Description: Optional - Security Group port to open on ECS instances - defaults to port 80
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'optional' and 'defaults to' parts of the description text are redundant- see how this currently renders in the console view:

image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

Value: !Join [' ', ['Created for ECS cluster', !Ref 'EcsClusterName']]
EcsElasticLoadBalancer:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Copy link
Contributor

@wjordan wjordan Feb 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resource could use a readable Name Property, in addition to the Name tag. (The current stack is using an auto-generated name freeg-EcsEl-XXXXXXXXXXXX which isn't ideal).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update.

Value: !Join [' ', ['Created for ECS cluster', !Ref 'EcsClusterName']]
DefaultTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also use a specific Name Property for better readability.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update.

@uponthesun uponthesun merged commit af2a6d5 into staging Feb 27, 2019
@uponthesun uponthesun deleted the geocoder-fargate branch February 27, 2019 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants