This solution assumes you already have a project created and set up where you wish to host these resources.
Time to complete: About 6 minutes
Click the Start button to move to the next step.
- Have an organization set up in Google cloud.
- Have a billing account set up.
- Have an existing project with billing enabled.
In order to spin up this architecture, you will need to be a user with the “Project owner” IAM role on the existing project:
Note: To grant a user a role, take a look at the Granting and Revoking Access documentation.
Before we deploy the architecture, you will need the following information:
- The project ID
Once the repository is cloned please run the following command to install the prerequisistes:
sh prereq.shYou will then be prompted to provide the project-id for the destination project.
After this is complete, you can kick off the Cloud Build pipeline with the following command:
gcloud builds submit . --config cloudbuild.yamlIf you encounter errors when running these commands, please attempt to run them again in a clean project.
If you face a problem with the EventArc API during the deployment, please check out the next section
You might face the error below while running it for the first time.
Step #2 - "tf apply": │ Error: Error creating function: googleapi: Error 400: Cannot create trigger projects/doc-ai-test4/locations/us-central1/triggers/form-parser-868560: Invalid resource state for "": Permission denied while using the Eventarc Service Agent.
If you recently started to use Eventarc, it may take a few minutes before all necessary permissions are propagated to the Service Agent. Otherwise, verify that it has Eventarc Service Agent role.
It happens because the Eventarc permissions take some time to propagate. First, make sure you ran the pre-req.sh script. Then, wait some minutes and trigger the deploy job again
At this point you should have successfully deployed the foundations for a Three Tier Web Application!.
This process may take a while to deploy, please do not close the window when deploying.
Next we are going to test the architecture and finally clean up your environment.
Once you deployed the solution successfully, upload an image to the image bucket using either Cloud Console or gsutil.
For example, you can download this image , and upload it to GCS using the command below. Note you must to replace the bucket name.
gcloud storage cp bicycle.jpg gs://<YOUR PROJECT NAME>-imagesThen, you can check the object localization results into a JSON file in the output bucket:
The BigQuery Transfer Service Job we create on this example runs every 15-min, and it will upload to BigQuery all image results in the output bucket. After it ran, you can check results on BigQuery.
Alternatively, feel free to trigger the job anytime by clicking on the RUN TRANSFER NOW button.
Execute the command below on Cloud Shell to destroy the resources.
gcloud builds submit . --config cloudbuild_destroy.yaml
The above command will delete the associated resources so there will be no billable charges made afterwards.
You’re all set!