Välkommen till en Compute Engine-webbplats med varm failover till Cloud Storagep>

hanterade instansgrupper återställs och kan betjäna trafik för hela webbplatsen erfarenhet. - Verifiera domänen som du vill använda med din Cloud Storage-hink. Skapa en Cloud Storage-bucket som matchar namnet på domänen du äger och vill använda: gsutil mb gsstatic-web.$DOMAIN De DOMAIN-variabel definierad i början av detta dokument används, som t.ex . Detta exempel lagrar de statiska filerna på exempel.com static-web.example.com. Skapa en lokal fil som du kopierar till Cloud Storage-bucket i Nästa steg: cat< index.html HA / DR example

Welcome to a test static web server with warm failover from Cloud Storagep>

HA / DR example

Welcome to a test static web server with warm failover from Cloud Storagep>

curlagain, or open your web browser, to access the IP address of the load balancer: curl $IP_ADDRESS It might take a few minutes for the load balancer to update the configuration and to correctly direct traffic back to your managed instance groups. If needed, wait a few minutes and try to access the website again. The main website from the managed instance groups is returned, as shown in the following example output: HA / DR example p>Welcome to a Compute Engine website with warm failover to Cloud Storagep> ## Clean up To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, either delete the project that contains the resources, or keep the project and delete the individual resources. To delete the individual resources created in this document, complete the following steps: - Delete the Cloud Storage bucket: gsutil rm -r gsstatic-web.$DOMAIN Delete the load balancer configuration: gcloud compute forwarding-rules delete n http-content-rule-$NAME_SUFFIX --global --quiet gcloud compute target-http-proxies delete n http-lb-proxy-$NAME_SUFFIX --quiet gcloud compute url-maps delete web-map-http-$NAME_SUFFIX --quiet gcloud compute url-maps delete web-map-http-bucket-$NAME_SUFFIX --quiet gcloud compute backend-services delete n web-backend-service-$NAME_SUFFIX --global --quiet gcloud compute backend-buckets delete web-bucket-$NAME_SUFFIX --quiet Delete the managed instance groups and health check: gcloud compute instance-groups managed delete n instance-group-$NAME_SUFFIX-$REGION1 n --region=$REGION1 --quiet gcloud compute instance-groups managed delete n instance-group-$NAME_SUFFIX-$REGION2 n --region=$REGION2 --quiet gcloud compute health-checks delete http-basic-check-$NAME_SUFFIX --quiet Delete the instance templates, images, base VM, and persistent disks: gcloud compute instance-templates delete n template-$NAME_SUFFIX-$REGION1 --quiet gcloud compute instance-templates delete n template-$NAME_SUFFIX-$REGION2 --quiet gcloud compute images delete image-$NAME_SUFFIX --quiet gcloud compute images delete image-disk-$NAME_SUFFIX --quiet gcloud compute instances delete vm-base-$NAME_SUFFIX n --zone=$ZONE --quiet Delete the firewall rules. gcloud compute firewall-rules delete n allow-health-check-$NAME_SUFFIX --quiet gcloud compute firewall-rules delete n allow-ssh-$NAME_SUFFIX --quiet gcloud compute firewall-rules delete n allow-http-$NAME_SUFFIX --quiet Delete the subnet and VPC. gcloud compute networks subnets delete n subnet-$NAME_SUFFIX-$REGION1 --region=$REGION1 --quiet gcloud compute networks subnets delete n subnet-$NAME_SUFFIX-$REGION2 --region=$REGION2 --quiet gcloud compute networks delete network-$NAME_SUFFIX --quiet ## What's next - - For an alternative approach that uses Cloud DNS instead of external HTTP(S) Load Balancing to control the failover, see Deploy a warm recoverable web server using Cloud DNS with Compute Engine and Cloud Storage. This pattern is useful if you have, or want to use, Cloud DNS. - To learn how how to determine the best approach for your own applications and which recovery method to use, see the Disaster recovery planning guide. - To see other patterns for applications, such as cold and hot failover, see Disaster recovery scenarios for applications. - For more ways to handle scale and availability, see the Patterns for scalable and resilient apps. - Explore reference architectures, diagrams, tutorials, and best practices about Google Cloud. Take a look at our Cloud Architecture Center.