Site icon k5n.us

Deploying WebCalendar to AWS

In this post, I am going to go over some of the options for installing WebCalendar using Amazon AWS. While both GCP and Azure provide a lot of the same services, AWS has the most market share in cloud services. So, let’s start with AWS. There are 200+ products and services available in AWS. That’s a lot of services! That means there is more than one way to deploy WebCalendar in AWS. I’ll go over the most common ways and discuss the benefits and issues with each here. Also, note I don’t tackle setting up HTTPS with a certificate here. That’s a discussion for another post.

Lightsail LAMP

Lightsail is a cost-effect way to get a LAMP system up and running in AWS with minimal work on your end. In fact, this very website (k5n.us) is hosted using Lightsail. This essentially sets up an EC2 instance (more about that below) for you so that you don’t need to be bothered with some of the security and network knowledge typically required to properly setup and secure an EC2 instance that hosts a website. Amazon provides a tutorial on how to setup LAMP with Lightsail right here. Once you have your LAMP setup working, the remaining steps are pretty simple and familiar if you’ve installed WebCalendar before:

Pros:

Cons:

EC2 Instance

An EC2 instance is essentially a cloud-based VM (virtual machine). For those unfamiliar with AWS, using a single EC2 instance is perhaps the best place to start learning (if you want to learn more about AWS). If you are unfamiliar with AWS but comfortable with a VM (perhaps from using VirtualBox or VMWare), this is an easy transition. You’ll need to get familiar with AWS networking to set this up and make it secure (VPCs, Subnets, Security Groups, etc.). To get started, you’ll need to select an operating system for your install. There are many Linux operating systems to choose from (Ubuntu, etc.) including one provided by Amazon. I normally go with Amazon Linux for a number of reasons (optimized for AWS, frequently updated, used in many online tutorials/examples, etc.) You’ll pick your base AMI (starting image), choose your storage and network settings, and off you go. Once your EC2 is up and running, you can login from your desktop using your SSH keys (normally creating and downloaded when setting up your EC2). From your EC2 command line, you can do the following:

Pros:

Cons:

ECS Fargate and RDS

This is the most robust way to install and run WebCalendar in AWS. Of course, it will be the most expensive and complicated to setup. The main cost drive here is AWS RDS, which is the managed service AWS offers for MySQL. AWS managed services (see here for Amazon’s explanation for why managed services are great) take care of a lot of worries for you, so that you don’t need to. For RDS, that means guaranteed uptime and automatic back-ups. You don’t need to worry about all that… you just need to pay for it.

ECS Fargate is how you deploy a docker container in AWS. There is no public docker image for WebCalendar yet, so you would need to build the image and deploy it to ECR. You can then setup a task definition in ECS pull down the image from ECR and run it. There is a learning curve to using ECS. This is more complicated than using either Lightsail or EC2. You would likely need to use AWS Secrets Manager to store your RDS credentials. You would likely have an Application Load Balancer (ALB) to sit in front of your running container. And you may also want to configure a Web Application Firewall (WAF) to either limit access or protect against certain attacks. To keep your WebCalendar installation secure, you will want to periodically rebuild your container image with the latest PHP and OS updates and redeploy the container.

Pros:

Cons:

The Best Solution: Infrastructure as Code

The best solution would be to automate the ECS Fargate and RDS deployment above using AWS CloudFormation. This would take a bit of work to do. You would need to include a method of installing and configuring WebCalendar on first startup. But once properly coded in a CloudFormation YAML template, you could deploy the entire stack with a few mouse clicks. You could also easily do multiple deployments in the same AWS account (development, test, integration, production). This could also be done with Terraform instead of CloudFormation, which would allow you to deploy to other cloud providers like GCP and Azure.

What about other PHP applications?

Yes, you may have noticed that almost everything discussed above applies to any PHP/MySQL application you want to deploy. An alternate title to this article could have been How to Deploy and LAMP Application to AWS.

Exit mobile version