This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -e | |
IMAGE_TAG="$GITHUB_SHA" | |
IMAGE_ARN=$1 | |
aws ecr get-login-password --region < AWS-REGION > | docker login --username AWS --password-stdin < YOUR-ECR-URI > | |
docker build -t < DOCKER-IMAGE-NAME >:$IMAGE_TAG . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DeploySSRApp | |
on: | |
push: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: An ECS, ECR, ALB and cloudfront stack | |
Resources: | |
ECSService: | |
Type: AWS::ECS::Service | |
DependsOn: | |
- HTTPListener | |
- HTTPSListener | |
Properties: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: An ECS, ECR, ALB and cloudfront stack | |
Resources: | |
ApplicationLoadBalancer: | |
Type: "AWS::ElasticLoadBalancingV2::LoadBalancer" | |
Properties: | |
Name: < APPLICATION_LOAD-BALANCER_NAME > | |
Subnets: #can add multiple subnet ids | |
- <SUBNET-ID-1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: An ECS, ECR, ALB and cloudfront stack | |
Resources: | |
ApplicationLBToECSSecurityGroup: | |
Type: "AWS::EC2::SecurityGroup" | |
Properties: | |
GroupDescription: SG for traffic between ALB and ECS service container | |
GroupName: < SECURITY-GROUP-NAME > | |
SecurityGroupIngress: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Deploy cloudformation stack | |
id: SSR-stack | |
uses: aws-actions/aws-cloudformation-github-deploy@v1 | |
with: | |
name: SSR-stack | |
template: infrastructure/template.yml | |
capabilities: CAPABILITY_IAM,CAPABILITY_NAMED_IAM | |
timeout-in-minutes: "10" | |
no-fail-on-empty-changeset: "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: An ECS, ECR, ALB and cloudfront stack | |
Resources: | |
ApplicationLBSecurityGroup: | |
Type: "AWS::EC2::SecurityGroup" | |
Properties: | |
GroupDescription: SG for the Fargate ALB traffic | |
GroupName: < SECURITY-GROUP-NAME > | |
SecurityGroupIngress: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: An ECS, ECR, ALB and cloudfront stack | |
Resources: | |
TargetGroup: | |
Type: "AWS::ElasticLoadBalancingV2::TargetGroup" | |
Properties: | |
Name: < TARGET-GROUP-NAME > | |
VpcId: < VPC-ID > | |
Protocol: HTTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: An ECS, ECR, ALB and cloudfront stack | |
Resources: | |
# http (port:80) listener redirects to https | |
HTTPListener: | |
Type: "AWS::ElasticLoadBalancingV2::Listener" | |
Properties: | |
DefaultActions: | |
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: An ECS, ECR, ALB and cloudfront stack | |
Resources: | |
ECSCluster: | |
Type: "AWS::ECS::Cluster" | |
Properties: | |
ClusterName: < CLUSTER-NAME > |