« Previous 1 2 3
Shifting Drupal to Amazon's cloud
Relocating to the Cloud
New Connection
After completing the upload, call the environment URL to view the page in the browser. Drupal's installation wizard appears first, because the page is not yet configured. Enter the database name from the RDS console, plus the user name and password (Table 2). Under Advanced Options | Host , you need the DB instance's Endpoint , which is also shown by the RDS console. The installation including the modules takes a few minutes.
Now fetch the previously exported data into the AWS database:
mysql -h RDS_HOSTNAME -u RDS_USERNAME -p RDS_PASSWORD
This command connects to the RDS database. You can then fetch the data from the old database and transfer it to the new database via the SQL dump file. The source
command will handle the import.
The final step is to set up the Auto Scaling Group for high availability of the environment. As a minimum, you will need two instances running all the time to avoid a single point of failure. In the case of updates, this prevents the site from temporarily disappearing from the web.
To do this, call the Beanstalk console, switch to your setup's configuration page, and then click on the Capacity Configuration tab. A click on Modify leads to the Auto Scaling Group section, where you can set the minimum number of instances to 2 and press Apply . The load balancer then routes the traffic to one of the two instances based on traffic load.
To make sure that content can be uploaded across several instances, the previously mentioned EFS is used here. It not only allows parallel and shared access to multiple instances, but it also grows and shrinks dynamically depending on the data volume.
HTTPS connections secured with TLS can be opened to the load balancer, but also to the individual instances. In the example, HTTPS support ends at the load balancer. If you want to use your own certificate, you first need to import it via the AWS Certificate Manager (ACM). It then appears in the Load Balancer menu later.
To upload a certificate, go to the application's Beanstalk page in the AWS console. In the configuration window, search for the Load Balancer Settings tab and press Modify . Now you can enter instances via Add Listener . Select Port 443 and HTTPS as the protocol for the load balancer, and Port 80 and HTTP for the instance. From the drop-down menu, then add the previously uploaded certificate.
Finally, it's time to set up the DNS settings for the Elastic Beanstalk application. This will route traffic to the new domain names. The CNAME entry must match the one used by the SSL certificate; otherwise, a common name mismatch error may occur.
Route 53, the DNS service for AWS, can be used to redirect traffic. First define the Record Set Alias for the DNS and add the load balancer DNS as the Alias Target. After saving the changes, enter the DNS name in the browser; you should now see the page.
Green and Blue
AWS Elastic Beanstalk performs an in-place update. While the service is updating the application version, the application is temporarily unavailable to users. A blue-green setup avoids this. If you want to deliver a new feature for the website, you do so in a completely new environment. Then simply exchange the CNAME entries for the two environments to redirect traffic to the updated version.
To install Drupal, you clone the application in Elastic Beanstalk and load the updated application in the cloned environment. Then perform a test and choose the URLs in Actions | Swap Environment URLs (Figure 6).
Infos
- AWS: http://aws.amazon.com
- CloudFormation: https://aws.amazon.com/cloudformation
- CNAME record: https://en.wikipedia.org/wiki/CNAME_record
- Drupal backup tool: https://www.drupal.org/project/backup_migrate
- VPC: https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html#what-is-vpc-subnet
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)