DEV Community

Cover image for Creating and deploying a website using Webiny Serverless CMS ⚡️ + Free SWAG 👚👕
Sven A for Webiny

Posted on • Edited on

Creating and deploying a website using Webiny Serverless CMS ⚡️ + Free SWAG 👚👕

| Note: This article is now slightly out of date. Please follow this article: https://docs.webiny.com/docs/get-started/quick-start

To prep for this tutorial there are a few prerequisites you'll need to have:

  1. NodeJs - In case you don't have it installed, follow this tutorial
  2. Yarn - Although it's a replacement for NPM, yarn comes with some added functionality, which is required to run Webiny.
  3. MongoDB database - I would recommend using MongoDB Atlas free tier
  4. AWS User credentials - Don't have one? Here is how to set it up

About the tutorial

In this tutorial, I'll walk you through steps of:

  1. Installing and configuring Webiny
  2. Deploying Webiny to your own AWS cloud
  3. Getting back a CDN URL to access your site
  4. Creating your first user
  5. Creating your first page

About Webiny

Webiny is an open-source CMS (webiny/webiny-js) created for serverless web development. It comes with several ready-made apps like Page Builder and a File Manager. There is a GraphQL API with integrated security and an AWS Cognito user pool.

You can use Webiny to build websites, applications, APIs and microservices. All that inside a serverless environment. The Serverless Framework handles the deployment operation.

1. Installing and configuring Webiny

First, make sure that you've got all the prerequisites in place. They are at the top of the article.

Installing Webiny is a simple matter of running the following command in your terminal:

npm -g install @webiny/cli
Enter fullscreen mode Exit fullscreen mode

Once the package is installed you can create your new project.

webiny create my-project
//note the link to the SWAG page 😉
cd my-project
Enter fullscreen mode Exit fullscreen mode

This will create the full project structure, including any dependencies and configuration files you will need.

Before we can deploy our project, there is only one more thing we need to configure. Open api/.env.json file and change the value of MONGODB_SERVER variable to match your database connection string.

In case you are using MongoDB Atlas, just click on the Connect button in your cluster and select the application connection option. You will get the connection URL back.

2. Deploying Webiny to AWS

Webiny uses 2 commands for deployments, one deploys the APIs and the other one deploys the React apps. Both commands need to be run from the root of your project.

Let's say we are deploying the website into our dev environment. To deploy the APIs run the following command:

webiny deploy-api --env=dev
Enter fullscreen mode Exit fullscreen mode

The first deployment might take 3-4 minutes to complete. The operation is deploying dozen lambda functions, several API Gateways, an S3 bucket, and creating a new CloudFront distribution.

After the deployment is done, you will see a screen with the URL to your API. It ends with /graphql.

Note: On the first deployment the URL will not work for about ~10 minutes. This is because CloudFront takes its sweet time to get created.

While you are waiting for the CloudFront URL to start working, you can trigger the deployment of the React apps:

webiny deploy-apps --env=dev
Enter fullscreen mode Exit fullscreen mode

The same thing, in the end you will get a CDN URL back.

4. Finishing the installation

Once the URL starts working, point your browser to {cdn_url}/admin to finish the installation. This will trigger an install process. In the first step, you will create your admin user. After that just follow all the steps until the end.

Webiny CMS Installation

5. Creating your first page

By default, Webiny will point you to a list of pages.
Alt Text

Click the big green button in the lower-left part of the screen to create a new page, this will open the page editor.

This video provides a good overview of how to use the page editor:

Done

Hope you have enjoyed this tutorial and learned a thing or two. In case you have any questions or comments, please post them below.

If you liked Webiny and wish to contribute to the project, we would love to have you. Join us on our Github.

GitHub logo webiny / webiny-js

Open-source serverless enterprise CMS. Includes a headless CMS, page builder, form builder, and file manager. Easy to customize and expand. Deploys to AWS.



Open-Source Serverless Enterprise CMS

Website | Documentation | Community Slack | Forum | Twitter

Prettier license SemVer PRs Welcome Contributor Covenant Join our Slack community https://www.webiny.com/slack

product-video-2022.mp4

Webiny Serverless CMS includes:

1️⃣ Page Builder - Drag&drop page editor. Pages are prerendered automatically and cached on CloudFront for lightning-fast delivery.

2️⃣ Headless CMS - Headless CMS with a GraphQL API. Build APIs and content models through a UI. It includes content revisions, localization, and fine-grain permission control.

3️⃣ File Manager - Upload files images. Search and organize your assets. It includes a built-in image editor for basic image manipulations.

4️⃣ Form Builder - Build forms with a drag&drop editor. Insert forms through Page Builder into your pages. It has webhook support and ReCaptcha integration.

All Webiny apps can be customized easily to fully fit an enterprise publishing workflow and integrate with leading identity providers like OKTA and Cognito.

🏁 Quick installation guide

  1. Create a Webiny project:

npx create-webiny-project my-new-project

  1. Deploy to your AWS…




Top comments (3)

Collapse
 
svenalhamad profile image
Sven A

Hi Aleksey,

it's a good question. At the moment we don't have a specific list, we hope to produce one in the near future.

To provide a bit more context. The specific set of policies will be defined by the AWS services you are deploying. By default, Webiny is deploying an Api Gateway, Lambda functions, S3 and a CloudFront service. However, if you decide to introduce another service say DynamoDB you would need to change the IAM policy. There are permissions that your AWS IAM user has (which is used for deploying the resources), and then there is also a question of limiting the permissions of each of the deployed resources by creating a specific IAM policy for each of them. As you can see it's a complex task, but one that is quite important from the security perspective and it is on our priority list. Best way to stay up to date is to subscribe to our newsletter list on our website, and we will let you know once we release this update.

Collapse
 
svenalhamad profile image
Sven A

Yes, the aws free tier is all you need to get started.

Collapse
 
allanleonardjr profile image
JR Leonard

Thanks Sven, can you provide any estimates around monthly AWS costs to run a small traffic website with Webiny?