-
-
Save fungilation/fc95de6137cf310ef96287ab8a81d8a6 to your computer and use it in GitHub Desktop.
Deploys BookStack wiki on AWS EC2
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
STACK=bookstack-ec2 # give the stack a name | |
REGION=us-west-2 # choose your region | |
DOMAIN= # wiki will be hosted at wiki.[DOMAIN] | |
aws cloudformation deploy \ | |
--template-file wiki.yaml \ | |
--stack-name $STACK \ | |
--region $REGION \ | |
--parameter-overrides Domain=$DOMAIN |
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
AWSTemplateFormatVersion: 2010-09-09 | |
Parameters: | |
Domain: | |
Type: String | |
Resources: | |
SecurityGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: Allows connections from anyhere | |
GroupName: WikiConnectionsIn | |
SecurityGroupIngress: | |
- CidrIp: 0.0.0.0/0 | |
FromPort: 80 | |
IpProtocol: TCP | |
ToPort: 80 | |
- CidrIp: 0.0.0.0/0 | |
FromPort: 443 | |
IpProtocol: TCP | |
ToPort: 443 | |
- CidrIp: 0.0.0.0/0 | |
FromPort: 22 | |
IpProtocol: TCP | |
ToPort: 22 | |
Instance: | |
DeletionPolicy: Retain | |
Type: AWS::EC2::Instance | |
Properties: | |
BlockDeviceMappings: | |
- DeviceName: /dev/sda1 | |
Ebs: | |
DeleteOnTermination: false | |
VolumeSize: 30 | |
DisableApiTermination: true | |
ImageId: ami-0497e51c56f8ea7da # us-west-2 ubuntu-22.04 - https://cloud-images.ubuntu.com/locator/ec2/ | |
InstanceInitiatedShutdownBehavior: stop | |
InstanceType: t3.micro | |
KeyName: # name of "Key pairs" on EC2 for ssh | |
SecurityGroups: | |
- !Ref SecurityGroup | |
Tags: | |
- Key: Name | |
Value: wiki | |
UserData: | |
Fn::Base64: !Sub | | |
#!/bin/bash -xe | |
sudo apt update | |
sudo apt install unzip | |
wget https://raw.githubusercontent.com/BookStackApp/devops/main/scripts/installation-ubuntu-22.04.sh | |
chmod a+x installation-ubuntu-22.04.sh | |
sudo ./installation-ubuntu-22.04.sh wiki.${Domain} | |
EIP: | |
Type: AWS::EC2::EIP | |
Properties: | |
InstanceId: !Ref Instance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment