This file contains hidden or 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
LaunchConfiguration: | |
Type: AWS::AutoScaling::LaunchConfiguration | |
Properties: | |
ImageId: !FindInMap [AWSRegionToAMI, !Ref "AWS::Region", AMI] | |
InstanceType: t2.micro | |
SecurityGroups: | |
- !Ref EC2HostSecurityGroup | |
IamInstanceProfile: !Ref InstanceProfile | |
UserData: | |
"Fn::Base64": !Sub | |
This file contains hidden or 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
InstanceRole: | |
Type: AWS::IAM::Role | |
Properties: | |
AssumeRolePolicyDocument: | |
Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Principal: | |
Service: | |
- ec2.amazonaws.com |
This file contains hidden or 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
Outputs: | |
VPC: | |
Description: A reference to the created VPC | |
Value: !Ref VPC | |
PublicSubnet1: | |
Description: A reference to the public subnet in the 1st Availability Zone | |
Value: !Ref PublicSubnet1 | |
PublicSubnet2: |
This file contains hidden or 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
// simple API | |
app.use('/healthcheck', require('express-healthcheck')()) | |
app.use('/echo', (req, res) => { | |
res.send({message: `Hello ${req.query.name}`}) | |
}) |
This file contains hidden or 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
Description: This template deploys infrastructure for SimpleAPI | |
Parameters: | |
Environment: | |
Description: An environment name that will be prefixed to resource names | |
Type: String | |
KeyName: | |
Description: EC2 key pair name for bastion host SSH access | |
Type: AWS::EC2::KeyPair::KeyName |
This file contains hidden or 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
Description: This template deploys security groups for SimpleAPI | |
Parameters: | |
Environment: | |
Description: An environment name that will be prefixed to resource names | |
Type: String | |
Namespace: | |
Description: An infrastructure namespace that will be prefixed to resource names | |
Type: String |
This file contains hidden or 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
Description: This template deploys bastion instance for SimpleAPI | |
Parameters: | |
BastionSecurityGroup: | |
Description: A reference to the security group for Bastion host | |
Type: String | |
Environment: | |
Description: An environment name that will be prefixed to resource names | |
Type: String |
This file contains hidden or 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
Description: This template deploys service instances for SimpleAPI | |
Parameters: | |
... | |
KeyName: | |
Description: EC2 key pair name for bastion host SSH access | |
Type: AWS::EC2::KeyPair::KeyName | |
... | |
Resources: |
This file contains hidden or 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 | |
PROFILE=$1 | |
REGION=$2 | |
BUCKET=$3 | |
AWS_PROFILE=$PROFILE AWS_REGION=$REGION aws s3 cp ./cloudformation/cf.bastion.instance.yml s3://$BUCKET/cf.bastion.instance.yml | |
AWS_PROFILE=$PROFILE AWS_REGION=$REGION aws s3 cp ./cloudformation/cf.loadbalancer.yml s3://$BUCKET/cf.loadbalancer.yml | |
AWS_PROFILE=$PROFILE AWS_REGION=$REGION aws s3 cp ./cloudformation/cf.master.yml s3://$BUCKET/cf.master.yml | |
AWS_PROFILE=$PROFILE AWS_REGION=$REGION aws s3 cp ./cloudformation/cf.network.yml s3://$BUCKET/cf.network.yml |
This file contains hidden or 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 | |
PROFILE=$1 | |
STACKNAME=$2 | |
BUCKET=$3 | |
ENVIRONMENT=$4 | |
AWS_PROFILE=$PROFILE aws cloudformation create-stack --stack-name $STACKNAME \ | |
--template-url https://s3.amazonaws.com/$BUCKET/cf.master.yml \ | |
--parameters ParameterKey=Environment,ParameterValue=$ENVIRONMENT \ |