InfraCopilot

The Intelligent Infra-as-Code Editor

Meet the most advanced infrastructure design tool that understands how to define, connect, scale your infrastructure-as-code

Powered by KlothoEngine v0.72



Create Long Running Service (Wordpress) using ALB, ECS, EFS, and RDS

Welcome! The purpose of this page is to create an architecture and deploy Wordpress to it. We'll walk you through the steps to create a new deployable architecture on AWS using ALB, ECS, EFS, and RDS.

Architecture

If this is your first architecture, take a look at the Getting Started Guide. When we're done, we'll have created the following architecture:

full-arch

Step 1. Drag in a Load Balancer

  • Locate the Load Balancer resource in the left sidebar
  • Drag it onto the canvas
  • Click on the resource's name and rename it to wordpress-lb

loadbalancer

Step 2. Drag in an ECS Service

  • Locate the ECS Service resource in the left sidebar
  • Drag it onto the canvas
  • Click on the resource's name and rename it to wordpress-ecs

ecs-service

Step 3. Drag in an RDS Instance

  • Locate the RDS Instance resource in the left sidebar
  • Drag it onto the canvas
  • Click on the resource's name and rename it to wordpress-db

rds-instance

Step 4. Drag in an EFS File System

  • Locate the EFS File System resource in the left sidebar
  • Drag it onto the canvas
  • Click on the resource's name and rename it to wordpress-fs

efs

Step 5. Configure the Load Balancer

  • Select the Load Balancer by left-clicking it
  • On the right side-bar ensure that the config tab is selected

config-loadbalancer

  • Set the Scheme config to be the value internet-facing
  • Click Apply Changes in the lower right

Step 6. Connect the Load Balancer to the ECS Service

  • Hover over the Load Balancer and click and drag the purple arrow to the ECS Service icon

loadbalancer-ecs

Step 7. Connect the ECS Service to the RDS Instance

  • Hover over the ECS Service and click and drag the purple arrow to the RDS Instance icon

full-arch

Step 8. Connect the ECS Service to the EFS File System

  • Hover over the ECS Service and click and drag the purple arrow to the EFS File System icon

full-arch

Step 9. Configure the ECS Service

  • Select the ECS Service by left-clicking it
  • On the right side-bar ensure that the config tab is selected

config-ecs-task

  • Set the base image to be wordpress
  • There should be some pre-populated environment fields referencing the RDS Instance we created earlier
  • Modify the names of the pre-populated fields or create the following environment variables by hitting the + sign at the bottom of the list. The key and values should be:
    • WORDPRESS_DB_HOST = aws:rds_instance:rds-instance-4#Endpoint
    • WORDPRESS_DB_USER = aws:rds_instance:rds-instance-4#Username
    • WORDPRESS_DB_PASSWORD = aws:rds_instance:rds-instance-4#Password
    • WORDPRESS_DB_NAME = aws:rds_instance:rds-instance-4#DatabaseName
  • Set the Container Path Field to be /var/www/html
  • Click Apply Changes in the lower right

Step 10. Configure Health Checks

  • Click the edge between the Load Balancer and ECS Service
  • On the right side-bar select the "Additional Resources" tab
  • Click on aws:target_group:<your load balancer name>
  • On the right side-bar select the config tab

config-healthchecks

  • Set the Health Check > Path field to be /
  • Click Apply Changes in the lower right

Step 11. Configure the EFS Access Point

  • Select the EFS File System by left-clicking it
  • Set all UID and GID fields to be 33 (this is the UID and GID for the www-data user in the wordpress container)
  • Click Apply Changes in the lower right

Step 12. Configure the RDS Instance

  • Select the RDS Instance by left-clicking it
  • On the right side-bar ensure that the config tab is selected

config-rds

  • Set the Engine config to be the value mysql
  • Set the Engine Version config to be the value 8.0.35 or any version supported by wordpress and AWS that you desire.
  • Click Apply Changes in the lower right

Step 13. Export IaC (Pulumi)

  • Click the Export IaC button on the top of the screen, this will download a zip file with the name of your architecture containing all the IaC to deploy it.

export-iac

Step 14. Local Docker, Pulumi, and AWS Setup

  • Create an AWS user with admin permissions
  • Follow the Pulumi guide to setup Pulumi with AWS using your credentials
  • You'll also need to install Docker for building a container and fetching images from DockerHub

Step 15. Deploy to AWS

  • Extract the IaC from the zip file
  • Navigate to the directory
  • Run npm install
  • Run pulumi stack init
  • Give your stack a name
  • Optionally specify a passphrase
  • Specify your region pulumi config set aws:region us-east-1 change us-east-1 to whichever region you desire
  • Create a custom username and password for your first database by running: pulumi config set --secret klo:wordpress-db-username <dbuser> and pulumi config set --secret klo:wordpress-db-password <dbpassword> replacing <dbuser> and <dbpassword> with your desired values ensuring you meet mysql username and password validation requirements
  • Run pulumi up
  • Review the plan and type yes to deploy
  • Grab the wordpress_lb_DomainName as that was reported after pulumi up completed
  • Although the stack is up it may take time for certain configuration and changes to propograte

Step 16. Access Wordpress

  • Navigate the wordpress_lb_DomainName we captured in the previous step
  • You should see the Wordpress setup page

wordpress-setup

  • Feel free to setup Wordpress as you see fit, plugins will install to the EFS filesystem we created earlier

Step 17. Tear down Infrastructure

  • From the same directory pulumi destroy
  • Confirm with yes

Step 18. Share Feedback

We look forward to seeing what amazing things you build. If you get stuck or want us to support a capability, please join our Community Discord, where the whole team hangs out and is happy to help.

Take your infrastructure copilot for a test flight

Frequently Asked Questions

We may have an answer for you. Here are some of our common FAQs:

How is the infrastructure-as-code being modified or generated?

InfraCopilot is powered by the Klotho engine, an adaptive architectures compiler that undertands cloud architectures and is able to reshape them. NLP is used only to interpret the user intent.

Klotho is the Wolfram Alpha of infrastructure.

What cloud services and providers do you support?

AWS support is now in early access, with Azure and Google Cloud support coming soon. For the latest up-to-date list of supported services, ask the Copilot!

How much does this cost?

We're focused on building a tool that makes your work more enjoyable. We haven't decided on a business model yet, but we do know InfraCopilot will always have a free tier. We'll have more to share in the coming months.

How can I contact you?

You can reach us on Twitter , Discord and LinkedIn !

Can I contribute to the project?

Yes! Klotho is open-source, join us on Discord and we'll help you get up and running!

Copyright © 2023 CloudCompiler Inc