AWS Public Sector Blog
Managing nonprofit members and donors with CiviCRM on AWS
Managing donors, members, and constituents is essential to the success of most nonprofits. Customer relationship management (CRM) systems are an important part of this process. There are several CRM applications that focus on the needs of nonprofit organizations. While many of these applications are commercial offerings, others are available at no cost. In this blog post, I’ll discuss a no-cost, nonprofit-focused CRM called CiviCRM.
A common challenge that many users encounter with open source CRMs is a lack of documentation related to deploying them in the cloud. For this reason, CiviCRM typically advises new users to work with an implementation partner to deploy it. However, in this post, I’ll walk through the steps to deploy CiviCRM yourself using Amazon Web Services (AWS). I’ll also describe an architecture for deploying CiviCRM in a way that is highly available and resilient to service disruptions or events.
About CiviCRM
Over 11,000 nonprofit organizations around the world use CiviCRM to build and manage their donor, member, and constituent bases. Nonprofits can use CiviCRM to store contact data, send personalized messages, plan events, manage membership programs, organize advocacy campaigns, and more.
CiviCRM is built on WordPress, one of the most popular and widely used open source content management systems (CMS). CiviCRM is also open source, which means that the source code for the application is available for anybody to view and modify, as long as your organization can comply with the licensing terms. This feature of open source software brings several benefits. For example, when you use open source applications, you can look directly at the source code to understand exactly what it’s doing with your data. Additionally, users who have the time and ability can modify the application to suit their own specific needs. Finally, open source software tends to be available at low or no cost; CiviCRM is available at no cost, although you can optionally donate to the development team.
Solution overview: Deploying CiviCRM on AWS
This AWS CloudFormation template can help you install CiviCRM using AWS services. AWS CloudFormation is an orchestration service that helps automatically deploy and configure AWS services and resources. A CloudFormation template also contains the instructions for deploying a certain set of services.
This CloudFormation template sets up an Amazon Virtual Private Cloud (Amazon VPC) instance. In this VPC instance, you can deploy AWS resources in your own isolated area of the AWS Cloud. In this case, the template deploys an Amazon Aurora MySQL-compatible database. It also deploys an Amazon EC2 Auto Scaling group to make sure at least one virtual machine is always running, and the necessary infrastructure and permissions for these systems to work together.
To continue, you must have an AWS account with a user that has permissions to launch CloudFormation stacks and create resources. If you don’t already have an AWS account, see the AWS Support Knowledge Center for complete instructions.
Deploying resources and installing WordPress
The first step to installing CiviCRM on AWS is to deploy the AWS resources that CiviCRM runs on.
To deploy this solution
1. Select the Launch Stack button. The CloudFormation page in the AWS Management Console opens.
2. Choose the Next button on the CloudFormation wizard to view the Specify stack details On this screen, you can specify parameters that control the configuration of the resources to be created. Specify the administrative user for the database cluster that will be created, the user’s password, the passwords used by the application for the WordPress and CiviCRM databases, and the Amazon Elastic Compute Cloud (Amazon EC2) instance type used as the web server.
3. Enter passwords in the three password fields. As a best practice, each of the three passwords should be You should use passwords that contain a combination of numbers, symbols, and uppercase and lowercase letters.
4. If you need to use a specific instance type, enter it in the Instance Type If you’re unsure, use the default value (t3.small). For more information about Amazon EC2 instance types, see the Instance Type Details page.
5. Leave the default values in the other fields. Select the Next button followed by the Next Check the box that says I acknowledge that AWS CloudFormation might create IAM resources and select the Submit button.
It takes about 15 minutes to fully deploy the resources. When the template finishes deploying resources, choose the Outputs tab of the CloudFormation stack, as shown in the following Figure 1.
Note: Keep this tab open—you’ll use some additional information from this page during the setup process.
Figure 1. The CloudFormation Outputs tab.
Installing the CiviCRM WordPress plugin
Because CiviCRM is built upon WordPress, you can simply install it using the WordPress plugin library.
To install the CiviCRM plugin
1. On the Output tab of the CloudFormation console, choose the URL next to LoadBalancerDNSName. This is the URL for your WordPress deployment. After loading the site, you should be presented with an installation screen for WordPress.
2. On the Welcome screen, enter the required information to complete the WordPress installation, as shown in Figure 2.
Figure 2. The WordPress installation screen.
- When you finish filling in the fields, choose Install WordPress. After about a minute, you’ll be prompted to login with your WordPress credentials. To activate your installation, navigate to the Plugins tab from the WordPress dashboard.
- Locate the plugin called CiviCRM, and then choose Activate, as shown in the following image.
Figure 3. Activating the CiviCRM plugin.
Activating the CiviCRM plugin installs CiviCRM into your WordPress installation. For this demo, I check the box to Load sample data, however you can leave this box unchecked if you don’t want any sample data loaded.
- In the Environment section, choose the pencil icon next to CiviCRM Database. Return to the Outputs tab for your CloudFormation stack. Copy the value next to CiviCRMConnectionString, and then paste it into the CiviCRM Database field, as shown in the following image. Choose the Apply button.
Figure 4. Installing CiviCRM on WordPress.
- Scroll to the bottom of the page and choose the Install CiviCRM After about a minute, the screen refreshes, and the CiviCRM installation is complete, as shown in the following image.
Figure 5. View of CiviMember with sample data.
Options for high availability
High availability refers to the ability of a system to operate continuously without failure. You can achieve high availability by eliminating single points of failure from a workload. A workload that is highly available helps you meet your internal or customer-facing service level agreements (SLAs).
In the architecture that you just deployed, CiviCRM is running on a single Amazon EC2 instance and a single Amazon Aurora database instance. While this configuration is cost-effective, it doesn’t provide high availability. The following sections describe how to improve the availability of these components.
Making the web server highly available
You can use an Amazon EC2 Auto Scaling group to increase the availability of your CiviCRM application. If the web server that’s running CiviCRM fails for any reason, the Auto Scaling group automatically starts a new, preconfigured Amazon EC2 instance.
To set up an Auto Scaling Group
- Navigate to the Amazon EC2 console.
- Under Instances, choose Instances.
- Select the instance that is running CiviCRM. On Actions menu, choose Image and templates > Create image, as shown in the following image.
Figure 6. In the Instances page, under the Actions menu, choose Image and templates, and then Create image.
- On the Create image page, enter a name for the image, and then choose Create image. In my case, I entered civicrm.
- On the Launch templates tab, choose the launch template for this solution. In my account, the launch template has the name civicrm-wordpress.
- In the launch template, chooseActions > Modify template (Create new version).
- In the Application and OS Images (Amazon Machine Image) section, choose the My AMIs tab and select the Amazon Machine Image (AMI) that you just created, as shown in the following image. Select the Create template version button to save the changes.
Figure 7. Updating the launch template to use the AMI created for the CiviCRM application.
- Finally, choose the Auto Scaling Groups tab and select the auto scaling group for this solution. In this walkthrough, the auto scaling group is called civicrm-AutoScalingGroup.
- In the Launch template section, choose Edit. In the page that appears, change the version from 1 to Latest (2). This step tells the auto scaling group to use the latest launch template we created in the previous steps. Choose Update.
These steps will launch a fully configured CiviCRM instance in the event that another instance fails. When AWS Auto Scaling Groups detects a failure, it starts a new instance based on the specified snapshot. However, any changes that you make to the instance after you take the snapshot (such as uploaded images) won’t be included in the restored image. If you are uploading images to your WordPress instance, consider using the WP Offload Media Lite for Amazon S3 WordPress plugin, which stores your images persistently in Amazon Simple Storage Service (Amazon S3).
If your site serves more than 10–15 users, consider setting capacity limits on your Auto Scaling group and configure dynamic scaling for the Auto Scaling group. Configuring these resources makes sure that you have enough compute capacity to meet the demand of your users. As traffic to your site increases, you can seamlessly scale up the number of servers to support the traffic.
Making the database highly available
Like the web server, it’s possible for database servers to become unavailable for a variety of reasons. To mitigate this risk, you can create a database reader instance. If a loss of connectivity is detected to the primary instance, Amazon Aurora automatically fails over to the secondary database server.
To create the database reader
- Navigate to the Amazon RDS console.
- Select the database cluster for this workload. It will be listed as Regional cluster under the Role column.
- From the Actions menu, select Add reader.
- On the next page, enter a DB instance identifier. This tutorial uses civicrm-reader. Select the Add reader
Clean up
To make sure you don’t continue to pay for any resources associated with this workload, go to the AWS CloudFormation console. Choose the stack associated with this workload (in this tutorial, it’s called civircrm), and then choose Delete. All the resources that you created by following this tutorial will be deleted.
In the Amazon EC2 console, under Images, choose AMIs. Select the AMI you created in this post. On the Actions menu, choose Deregister AMI to delete the AMI.
Conclusion and next steps
Most nonprofits maintain data about their donors, members, beneficiaries, and constituents. However, they need the right tools to turn that data into actions and insights. CiviCRM, an open-source CRM application designed specifically for nonprofit organizations, can help with this need.
As a next step, consider using Amazon S3 to store the images that you upload to your site. This step decouples image storage from your web server, making it simpler to scale your site. If you have viewers across the globe, you can further improve the responsiveness of your site by using Amazon CloudFront. You can even restrict access to your load balancers so that traffic must come through Amazon CloudFront.
To learn more about how nonprofit organizations around the world use AWS to support their missions, visit the AWS for Nonprofits home page. You can also find information about AWS Solutions and Partners for nonprofits on the Solutions for Nonprofits page in the AWS Solutions Library.
Read more about AWS for nonprofits:
- Now available: New AWS program supporting nonprofit donor and member engagement
- Data Lake for Nonprofits – powered by AWS and Salesforce.org now available to help unleash data insights
- How nonprofits reimagine work using smart technology
- Supporting our nonprofit customers through change and transformation
- Unifying data to boost nonprofit fundraising outcomes
Subscribe to the AWS Public Sector Blog newsletter to get the latest in AWS tools, solutions, and innovations from the public sector delivered to your inbox, or contact us.
Please take a few minutes to share insights regarding your experience with the AWS Public Sector Blog in this survey, and we’ll use feedback from the survey to create more content aligned with the preferences of our readers.