Gatsby Cloud is a performant platform for building your Gatsby site. Even better, it integrates with Content Delivery Networks (CDNs) like Netlify so you can build and deploy your site seamlessly.
This guide assumes you already:
- have a Netlify account
- have a Gatsby Cloud site created
You can use either of the following site creation options if you don't have one already:
Setting Up a Hosting Integration
Once your site is available inside Gatsby Cloud you can “view details” and navigate to the “Site Settings” tab.
Inside Site Settings there is an “Integrations” link. Select this menu item and scroll down to the section titled “Hosting Integrations”.
This is where you’ll see the Netlify logo. Click the “Connect” button to the right of that logo and you’ll be prompted to login into your Netlify account. If you don’t have one, you can create one at this time.
Once you’re authenticated with Netlify you’ll be prompted to authorize Gatsby Cloud to interact with Netlify on your behalf. After you’ve completed this step, you’re ready to configure deployment in Gatsby Cloud.
There are two ways to set up deployment.
Create a new deployment site on Netlify
If you don’t already have a deployment target, Gatsby Cloud can automatically create one for you. You’ll need to input a “Netlify deployment site name” (or use the one generated for you) and select which Netlify team to add the site to from the provided dropdown.
Note that the site name cannot conflict with any other site name currently configured under your Netlify account.
Connect to an existing site
You may already have a deployment target you’ve set up on Netlify that you’d like to use. On the “Netlify Integration” screen there will be a link to connect an existing site at the bottom of the page.
From there, select your Netlify team and the site you want to publish to.
And that’s it! Your site is now set up to build and deploy. Gatsby Cloud will handle everything for you. However, if you want to make a change to your domain you’ll want to do that directly on the Netlify dashboard.
Note that you can only have one hosting integration. If you choose to configure another provider, that will override your existing Netlify integration.
Does Gatsby Cloud work with Netlify Functions?
Yes! Gatsby Cloud will deploy any functions found in the the
/public/functions directory after
If you keep your functions in
/static/functions, they will be copied and deployed automatically!
If you would like your functions in a different location in your repo, you can use the onPostBuild API in
gatsby-node.js and write your own custom logic for copying files. Here is an example of how you might do that.