aws-ecs-grafana/cloudformation/grafana/top.yaml
Joseph Manley 91d9e08511 Intial grafana stack
Move workflows into .github directory

Fix directory structure

Fix container name

Fix directory structure

Fix parameter names

Remove health check temp

Health check

work plz

Working version
2020-04-25 22:40:26 -04:00

112 lines
3.1 KiB
YAML

AWSTemplateFormatVersion: '2010-09-09'
Description: Grafana ECS Service
Parameters:
#------------------------
# Deployment Information
#------------------------
environment:
Type: String
Description: Name of the environment to use in naming.
Default: production
release:
Type: String
Description: Name of the release name of the stack version to use.
Default: production
AllowedValues: ['develop', 'production']
ConstraintDescription: "Must be a possible release version."
VpcId:
Description: ID of the VPC
Type: AWS::EC2::VPC::Id
#-------------------
# ECS Configuration
#-------------------
EcsCluster:
Type: String
Description: The cluster to run the Grafana service on.
#-----------------
# Load Balancing
#-----------------
PublicSubnets:
Description: The public subnets for the ALB to run in.
Type: String
PortalCertificate:
Description: Arn of AWS Certificate
Type: String
#-----
# DNS
#-----
Domain:
Type: String
Description: The domain to create the endpoint on (Must have an existing hosted zone ex. `example.com`) Leave blank to skip DNS.
Default: ""
SubDomain:
Type: String
Description: The subdomain to be used by grafana. (ex. `grafana.example.com`)
Default: grafana
#------------
# CloudWatch
#------------
LogGroup:
Type: String
Description: The AWS CloudWatch log group to output logs to.
Default: "/ecs/grafana"
Conditions:
CreateDns: !Not [!Equals [!Ref Domain, ""]]
Resources:
#-----
# DNS
#-----
DnsRecords:
Condition: CreateDns
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub 'https://s3.${AWS::Region}.amazonaws.com/sumu-stacks/grafana/${release}/cloudformation/grafana/dns.yaml'
Parameters:
environment: !Ref environment
Domain: !Ref Domain
SubDomain: !Ref SubDomain
GrafanaDns: !GetAtt LoadBalancing.Outputs.PublicAlbDnsName
#-----------------
# Load Balancing
#-----------------
LoadBalancing:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub 'https://s3.${AWS::Region}.amazonaws.com/sumu-stacks/grafana/${release}/cloudformation/grafana/load_balancing.yaml'
Parameters:
environment: !Ref environment
release: !Ref release
VpcId: !Ref VpcId
PublicSubnets: !Ref PublicSubnets
PortalCertificate: !Ref PortalCertificate
#-------------------
# ECS Task & Service
#-------------------
TaskDefinition:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub 'https://s3.${AWS::Region}.amazonaws.com/sumu-stacks/grafana/${release}/cloudformation/grafana/task.yaml'
Parameters:
LogGroupName: !Ref LogGroup
EcsService:
DependsOn: LoadBalancing
Type: AWS::ECS::Service
Properties:
Cluster: !Ref EcsCluster
DesiredCount: 1
TaskDefinition: !GetAtt TaskDefinition.Outputs.TaskArn
LoadBalancers:
- ContainerName: "grafana"
ContainerPort: 3000
TargetGroupArn: !GetAtt LoadBalancing.Outputs.AdminPortalTargetGroup