esn89 / nextcloud-aws-cdk

Self-hosted Nextcloud on AWS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nextcloud and AWS CDK Python project

This is a project to deploy a dockerized Nextcloud on AWS with the AWS Cloud Development Kit.

This project also demonstrates using a multi-stack approach to create a networking layer, database, storage and an autoscaling group with a load balancer. It also deploys the containerized application in the private subnet with a load balancer and NAT gateway in the public subnet. Furthermore, an example of how to load userdata into the autoscaling group is also shown.

NetworkStack - creates subnets, VPCs and routes and route tables

RDSStack - creates a MySQL instance

EFSStack - creates an elastic file store

ASGStack - contains the code for an autoscaling group, application loadbalancer and some security groups to allow the load balancer to access the instance. Also contains an example on how to load user data into the instance.

There are a few manual steps needed to be done as some resources such as the EFS are in a experimental state.

  1. Mount points needs to be created in each of the two availability zones, after deploying the EFSStack
  2. After the creation of the RDS instance, the password and connection string needs to be added to the userdata script here.

To run:

cdk deploy NetworkStack

cdk deploy RDSStack

cdk deploy EFSStack

cdk deploy ASGStack

Useful commands

  • cdk ls list all stacks in the app
  • cdk synth emits the synthesized CloudFormation template
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk docs open CDK documentation

About

Self-hosted Nextcloud on AWS


Languages

Language:Python 82.9%Language:Shell 12.9%Language:Batchfile 4.3%