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
Lambda: | |
Type: AWS::Lambda::Function | |
Properties: | |
Code: | |
ZipFile: | | |
def handler(event, context): | |
response = { | |
'isBase64Encoded': False, | |
'statusCode': 200, | |
'body': 'HELLO WORLD!' |
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
LoadBalancerSecGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: Load balance allow port 80 traffic | |
VpcId: !ImportValue VPCID | |
SecurityGroupIngress: | |
CidrIp: 0.0.0.0/0 | |
FromPort: 80 | |
IpProtocol: TCP | |
ToPort: 80 |
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
Lambda: | |
Type: AWS::Lambda::Function | |
Properties: | |
Code: | |
ZipFile: | | |
def handler(event, context): | |
response = { | |
'isBase64Encoded': False, | |
'statusCode': 200, | |
'body': 'HELLO WORLD!', |
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
from aiohttp import web | |
import aiohttp_cors | |
import json | |
async def healthcheck(_): | |
headers = { | |
"Cache-Control": "no-cache, no-store, must-revalidate", | |
"Pragma": "no-cache", | |
"Expires": "0", | |
} |
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
LoadBalancerSecGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: Load balancer only allow http port traffic | |
VpcId: !ImportValue VPCID | |
SecurityGroupIngress: | |
CidrIp: 0.0.0.0/0 | |
FromPort: 80 | |
IpProtocol: TCP | |
ToPort: 80 |
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
FROM python:3.7-slim | |
COPY requirements.txt /app/requirements.txt | |
WORKDIR /app | |
RUN pip install -r requirements.txt | |
COPY src /app | |
EXPOSE 5000 | |
CMD python app.py |
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
ECSCluster: | |
Type: 'AWS::ECS::Cluster' | |
Properties: | |
ClusterName: ECSCluster | |
CapacityProviders: | |
- FARGATE_SPOT | |
DefaultCapacityProviderStrategy: | |
- CapacityProvider: FARGATE_SPOT | |
Weight: 1 | |
ClusterSettings: |
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
LaunchTemplate: | |
Type: AWS::EC2::LaunchTemplate | |
Metadata: | |
AWS::CloudFormation::Init: | |
config: | |
packages: | |
yum: | |
amazon-ssm-agent: [] | |
commands: | |
00_amazon_ssm_agent_start: |
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
AutoScalingPolicy: | |
Type: AWS::AutoScaling::ScalingPolicy | |
Properties: | |
AutoScalingGroupName: !Ref AutoScalingGroup | |
PolicyType: TargetTrackingScaling | |
TargetTrackingConfiguration: | |
PredefinedMetricSpecification: | |
PredefinedMetricType: ASGAverageCPUUtilization | |
TargetValue: 70 |
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
AutoScalingGroup: | |
Type: AWS::AutoScaling::AutoScalingGroup | |
Properties: | |
MinSize: "1" | |
MaxSize: "2" | |
DesiredCapacity: "2" | |
HealthCheckGracePeriod: 300 | |
MixedInstancesPolicy: | |
InstancesDistribution: | |
OnDemandBaseCapacity: 1 |
OlderNewer