Skip to content

Commit 24da0cc

Browse files
authored
Merge pull request #8 from martygubar/main
Many updates to support google cloud
2 parents bc2385f + 574ed2a commit 24da0cc

30 files changed

+655
-337
lines changed

multicloud/azure-cli/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Oracle Database@Azure: Create an Autonomous Database
22
There are different ways that you can deploy a new Oracle Autonomous Database:
33
* [Using the Azure Portal](https://youtu.be/QOCvRr5CfeQ)
4-
* [Using Terraform scripts](https://github.com/oci-landing-zones/terraform-oci-multicloud-azure/tree/main)
4+
* [Using Terraform scripts](https://github.com/oci-landing-zones/terraform-oci-multicloud-azure)
55
* Using the Azure CLI
66

77
The steps below show how to create an Autonomous Database using the Azure CLI.
@@ -29,6 +29,8 @@ You can run the scripts independently or run `create-all-resources.sh`. Simply u
2929
|[create-all-resources.sh](create-all-resources.sh)|Creates your resource group, network, ADB and VM|
3030
|[create-data-lake-storage.sh](create-data-lake-storage.sh)|Creates an Azure Data Lake Gen 2 storage account, a container and uploads sample data into that container|
3131
|[delete-all-resources.sh](delete-all-resources.sh)|Deletes your resource group, network, ADB and VM|
32+
|[show-adb-info.sh](show-adb-info.sh)|Shows information about your ADB - including you JDBC connection details to the HIGH service|
33+
|[show-data-lake-storage-info.sh](show-data-lake-storage-info.sh)|Shows information about your data lake storage - including the storage endpoint URL|
3234

3335
### Configuration file
3436
The Azure cli deployment scripts rely on settings found in the config file. These resources **will be created** by the scripts. Update the config file prior to running any of the scripts.
@@ -80,6 +82,8 @@ Connect to your Autonomous Database!
8082
* Use these great VS Code extensions that help you develop and debug your database apps:
8183
* SQL Developer for VS Code ([Learn More](https://www.oracle.com/database/sqldeveloper/vscode/) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.sql-developer))
8284
* Oracle Developer Tools for VS Code ([Learn More](https://docs.oracle.com/en/database/oracle/developer-tools-for-vscode/getting-started/gettingstarted.html) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.oracledevtools))
85+
* [Use the sample scripts](../../sql/README.md) to learn how to use different features - like Select AI, data lake integration, JSON, and more.
86+
8387

8488
#### JDBC Example:
8589
JDBC is a common way to connect to Autonomous Database. For example, you can use the **Custom JDBC URL** in the VS Code SQL Developer Extension:

multicloud/azure-cli/config

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,49 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
33

44
# update the values below to match your requirements
5-
LOCATION="eastus"
6-
RESOURCE_GROUP="development"
5+
# Region and resource groupwhere resources are deployed
6+
# example: eastus
7+
LOCATION=""
8+
RESOURCE_GROUP=""
79
ADB_NAME="quickstart"
810

911
## NETWORKING
1012
# database
11-
VNET_NAME="dev-vnet"
12-
VNET_PREFIX="19x.xxx.0.0/16"
13+
# example: dev-vnet
14+
VNET_NAME=""
15+
# example: 192.168.0.0/16
16+
VNET_PREFIX=""
1317

1418
# subnet for the database
15-
SUBNET_NAME="dev-sn-db"
16-
SUBNET_PREFIX="19x.xxx.1.0/24"
19+
# example: dev-sn-db
20+
SUBNET_NAME=""
21+
# example: 192.168.1.0/24
22+
SUBNET_PREFIX=""
1723

1824
# client subnet
19-
SUBNET2_NAME="dev-sn-client"
20-
SUBNET2_PREFIX="19x.xxx.2.0/24"
25+
# example: dev-sn-client
26+
SUBNET2_NAME=""
27+
# example: 192.168.2.0/24
28+
SUBNET2_PREFIX=""
2129

2230
#network security group
2331
NSG_NAME=$SUBNET2_NAME-nsg
2432

2533
## COMPUTE VM
26-
VM_NAME="adb-vm-client"
34+
# example: adb-vm-client
35+
VM_NAME=""
2736
VM_PREFERRED_SIZES=( "Standard_DS3_v2" "Standard_DC1s_v2" "Standard_DC2s_v2" "Standard_DC2ads_v5" "Standard_L4s" )
2837
VM_IMAGE="MicrosoftWindowsDesktop:Windows-11:win11-22h2-pro:latest"
2938

3039
## CLOUD STORAGE
3140
# Storage accounts require a unique name across azure. Enter your unique name below.
32-
STORAGE_ACCOUNT_NAME="your-storage-account"
41+
# example: devadbstorageacct
42+
STORAGE_ACCOUNT_NAME=""
3343
STORAGE_CONTAINER_NAME="adb-sample"
3444

3545
## IDENTITIES
3646
# This identity will be used for your VM. The password will also be used for the database ADMIN user
3747
USER_NAME="adb"
38-
--The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
48+
# The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
49+
# example: watchS0meMovies#
3950
USER_PASSWORD=""

multicloud/azure-cli/config.default

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,49 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
33

44
# update the values below to match your requirements
5-
LOCATION="eastus"
6-
RESOURCE_GROUP="development"
5+
# Region and resource groupwhere resources are deployed
6+
# example: eastus
7+
LOCATION=""
8+
RESOURCE_GROUP=""
79
ADB_NAME="quickstart"
810

911
## NETWORKING
1012
# database
11-
VNET_NAME="dev-vnet"
12-
VNET_PREFIX="19x.xxx.0.0/16"
13+
# example: dev-vnet
14+
VNET_NAME=""
15+
# example: 192.168.0.0/16
16+
VNET_PREFIX=""
1317

1418
# subnet for the database
15-
SUBNET_NAME="dev-sn-db"
16-
SUBNET_PREFIX="19x.xxx.1.0/24"
19+
# example: dev-sn-db
20+
SUBNET_NAME=""
21+
# example: 192.168.1.0/24
22+
SUBNET_PREFIX=""
1723

1824
# client subnet
19-
SUBNET2_NAME="dev-sn-client"
20-
SUBNET2_PREFIX="19x.xxx.2.0/24"
25+
# example: dev-sn-client
26+
SUBNET2_NAME=""
27+
# example: 192.168.2.0/24
28+
SUBNET2_PREFIX=""
2129

2230
#network security group
2331
NSG_NAME=$SUBNET2_NAME-nsg
2432

2533
## COMPUTE VM
26-
VM_NAME="adb-vm-client"
34+
# example: adb-vm-client
35+
VM_NAME=""
2736
VM_PREFERRED_SIZES=( "Standard_DS3_v2" "Standard_DC1s_v2" "Standard_DC2s_v2" "Standard_DC2ads_v5" "Standard_L4s" )
2837
VM_IMAGE="MicrosoftWindowsDesktop:Windows-11:win11-22h2-pro:latest"
2938

3039
## CLOUD STORAGE
3140
# Storage accounts require a unique name across azure. Enter your unique name below.
32-
STORAGE_ACCOUNT_NAME="your-storage-account"
41+
# example: devadbstorageacct
42+
STORAGE_ACCOUNT_NAME=""
3343
STORAGE_CONTAINER_NAME="adb-sample"
3444

3545
## IDENTITIES
3646
# This identity will be used for your VM. The password will also be used for the database ADMIN user
3747
USER_NAME="adb"
38-
--The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
48+
# The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
49+
# example: watchS0meMovies#
3950
USER_PASSWORD=""

multicloud/azure-cli/create-data-lake-storage.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ echo "Upload files to that directory"
6262
az storage fs directory upload \
6363
--account-name $STORAGE_ACCOUNT_NAME \
6464
--file-system $STORAGE_CONTAINER_NAME \
65-
--source "../sql/support-site/*" \
65+
--source "../../sql/support-site/*" \
6666
--destination-path support-site \
6767
--recursive \
6868
--auth-mode login
@@ -78,7 +78,7 @@ echo "Upload files to that directory"
7878
az storage fs directory upload \
7979
--account-name $STORAGE_ACCOUNT_NAME \
8080
--file-system $STORAGE_CONTAINER_NAME \
81-
--source "../sql/data/*" \
81+
--source "../../sql/data/*" \
8282
--destination-path data \
8383
--recursive \
8484
--auth-mode login
@@ -99,8 +99,10 @@ az storage account keys list \
9999
--resource-group $RESOURCE_GROUP --query "[0].value" -o tsv
100100

101101
echo "Storage URL:"
102-
az storage account show \
102+
STORAGE_URL=$(az storage account show \
103103
--name $STORAGE_ACCOUNT_NAME \
104104
--query primaryEndpoints.blob \
105-
--output tsv
105+
--output tsv)
106+
echo $STORAGE_URL$STORAGE_CONTAINER_NAME
107+
106108
echo ""

multicloud/azure-cli/show-data-lake-storage-info.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ az storage account keys list \
1515
--account-name $STORAGE_ACCOUNT_NAME \
1616
--resource-group $RESOURCE_GROUP --query "[0].value" -o tsv
1717
echo "Storage URL:"
18-
az storage account show \
18+
STORAGE_URL=$(az storage account show \
1919
--name $STORAGE_ACCOUNT_NAME \
2020
--query primaryEndpoints.blob \
21-
--output tsv
21+
--output tsv)
22+
echo $STORAGE_URL$STORAGE_CONTAINER_NAME
2223
echo ""
2324

multicloud/gcloud-cli/README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Oracle Database@Google Cloud: Create an Autonomous Database
2+
There are different ways that you can deploy a new Oracle Autonomous Database:
3+
* [Using the Google Cloud Portal](https://docs.oracle.com/en-us/iaas/ogadb/ogadb-provisioning-autonomous-database.html)
4+
* [Using Terraform scripts](https://github.com/oci-landing-zones/terraform-oci-multicloud-azure)
5+
* Using the Google Command Line Interace (gcloud CLI)
6+
7+
8+
The steps below show how to create an Autonomous Database using the gcloud CLI.
9+
10+
## Prerequisites:
11+
* [Install the gcloud CLI](https://cloud.google.com/sdk/docs/install)
12+
* [Onboard Oracle Database@Google Cloud](https://docs.oracle.com/en-us/iaas/Content/database-at-gcp/oagcp-onboard.htm#oagcp_onboard). Onboarding includes subscribing to the service using a Pay as You Go or private offer, setting up permissions, and more.
13+
14+
## Deploy your Autonomous Database and your infrastructure
15+
The gcloud CLI scripts will deploy the following infrastructure:
16+
* A VPC Network with a client subnet
17+
* An Oracle Autonomous Database. It is deployed to a private subnet on that VPC Network. That private subnet is managed by Oracle Database@Google Cloud.
18+
* A Windows-based Virtual Machine is deployed to the client subnet. You can RDP to that VM to develop your apps and access Autonomous Database.
19+
* A Cloud Storage bucket with sample data
20+
* Sample code will use Google Gemini. Ensure the API is enabled.
21+
22+
23+
![deployment](../images/gcloud-deployment.png)
24+
25+
**Note:** Gemini is used by the samples - but the scripts do not set up access to the resource. See the [Generative AI on Vertex Quickstart](https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal?authuser=1)
26+
27+
You can run the scripts independently or run `create-all-resources.sh`. Simply update the [`config`](#configuration-file) prior to running the scripts:
28+
29+
|Script|Description|
30+
|----|---|
31+
|[create-network.sh](create-network.sh)|Creates a VPC Network and subnet with required firewall rules. ADB is accessed thru a private endpoint on this network. The VM is deployed to this network and can be used to work with ADB.|
32+
|[create-adb.sh](create-adb.sh)|Create an Autonomous Database|
33+
|[create-compute-vm.sh](create-compute-vm.sh)|Create a VM in that VPC. By default, a Windows VM is created and can be accessed via RDP. After running this script, you can set up the password by running: <br>`source config`<br>`gcloud compute reset-windows-password $VM_NAME --zone=$REGION-a`|
34+
|[create-all-resources.sh](create-all-resources.sh)|Creates your network, ADB, VM and Cloud Storage bucket.|
35+
|[create-data-lake-storage.sh](create-data-lake-storage.sh)|Creates a bucket on Cloud Storage and uploads sample data into that bucket|
36+
|[delete-all-resources.sh](delete-all-resources.sh)|Deletes your resource group, network, ADB and VM|
37+
|[show-adb-info.sh](show-adb-info.sh)|Shows information about your ADB - including you JDBC connection details to the HIGH service|
38+
|[show-data-lake-storage-info.sh](show-data-lake-storage-info.sh)|Shows information about your data lake storage - including the storage endpoint URL|
39+
40+
### Configuration file
41+
The gcloud CLI deployment scripts rely on settings found in the config file. These resources **will be created** by the scripts. Update the config file prior to running any of the scripts.
42+
43+
>**IMPORTANT:** This file will contain a password that is used to connect to Autonomous Database and the virtual machine. Set the file's permissions so that only the file's owner can view its contents:
44+
```bash
45+
chmod 600 config
46+
```
47+
48+
|Setting|Description|Example|
49+
|----|----|----|
50+
|REGION|Region where resources will be deployed. [See documentation](https://docs.oracle.com/en-us/iaas/Content/database-at-gcp/oagcp-regions.htm) for region availability|"us-east4"|
51+
|PROJECT|Target Google Cloud project for new resources|"development"|
52+
|USER_PASSWORD|The password for the Autonomous Database admin user|"watchS0meMovies#"|
53+
|ADB_NAME|Autonomous Database name. This name must be unique within a region location|"quickstart"|
54+
|SUBNET_DB_IP_RANGE|IP address range used for ADB. It can not overlap with the client subnet range. It can overlap with other ADB instances.|"192.168.11.0/24"|
55+
|VPC_NETWORK_NAME|Name of the VPC Network|"dev-network"|
56+
|VNET_PREFIX|CIDR range for the virtual network|"192.168.0.0/16"|
57+
|SUBNET_CLIENT_NAME|Name of the client subnet where the VM is deployed|"dev-sn-client"|
58+
|SUBNET_CLIENT_IP_RANGE|CIDR range for the client subnet|"192.168.10.0/24"|
59+
|VM_NAME|Name of the virtual machine|"dev-vm-client"|
60+
|VM_IMAGE_FAMILY|The image deployed to the VM |"windows-2022"|
61+
|VM_MACHINE_TYPE|The type of VM deployed|"e2-standard-4"|
62+
|BUCKET_NAME|The name of the cloud storage bucket where sample files will be uploaded.|"adb-sample-quickstart"|
63+
64+
65+
### Using the scripts
66+
Make sure that you have enabled APIs for your project. [See the documentation](https://cloud.google.com/endpoints/docs/openapi/enable-api) for details.
67+
68+
Log into Google Cloud from the CLI:
69+
```bash
70+
gcloud auth login
71+
```
72+
73+
Update the config file
74+
Then, run your scripts. The following will deploy a complete environment, but you can also install independent components. Just make sure you install dependencies (e.g. a VCN prior to Autonomous Database):
75+
76+
Creating all of the resources will take approximately 15-20 minutes.
77+
78+
```bash
79+
./create-all-resources.sh
80+
```
81+
82+
Check for errors after running the script. For example, VM availability can impact the success of creating the resource. If there is an issue, simply rerun the script that creates the resource (note: you may need to update the config file).
83+
84+
## What's next
85+
Connect to your Autonomous Database!
86+
* [Learn about connectivity options](https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/connect-preparing.html)
87+
* Use these great VS Code extensions that help you develop and debug your database apps:
88+
* SQL Developer for VS Code ([Learn More](https://www.oracle.com/database/sqldeveloper/vscode/) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.sql-developer))
89+
* Oracle Developer Tools for VS Code ([Learn More](https://docs.oracle.com/en/database/oracle/developer-tools-for-vscode/getting-started/gettingstarted.html) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.oracledevtools))
90+
* [Use the sample scripts](../../sql/README.md) to learn how to use different features - like Select AI, data lake integration, JSON, and more.
91+
92+
93+
#### JDBC Example:
94+
JDBC is a common way to connect to Autonomous Database. For example, you can use the **Custom JDBC URL** in the VS Code SQL Developer Extension:
95+
![connection dialog](../images/connect-dialog.png)
96+
97+
Notice the `jdbc:oracle:thin:@` prefix followed by a connection string. You can find the connection string in different ways.
98+
99+
1. Go to your Autonomous Database blade in the Azure Portal and go to **Settings -> Connections**:
100+
![Azure Portal connections](../images/connections-portal.png)
101+
2. Use the Azure cli script [`show-adb-info.sh`](./show-adb-info.sh). That script will return information about your Autonomous Database, including connection details.
102+
103+
<hr>
104+
Copyright (c) 2024 Oracle and/or its affiliates.<br>
105+
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

multicloud/gcloud-cli/config

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
4+
# update the values below to match your requirements
5+
# example: us-east4
6+
REGION=""
7+
PROJECT=""
8+
9+
## IDENTITIES
10+
# The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
11+
# example: watchS0meMovies#
12+
USER_PASSWORD=""
13+
14+
## ADB properties
15+
# Database name. This will be used for the display name as well.
16+
ADB_NAME="quickstart"
17+
18+
# ADB IP range. It can not overlap with the client subnet range
19+
# example: 192.168.11.0/24
20+
SUBNET_DB_IP_RANGE=""
21+
22+
## NETWORKING
23+
# public client network
24+
# example: dev-network
25+
VPC_NETWORK_NAME=""
26+
27+
# names firewall rules
28+
VPC_FIREWALL_INGRESS_NAME="allow-common-ingress-ports"
29+
VPC_FIREWALL_EGRESS_NAME="allow-client-egress-ports"
30+
31+
# client subnet
32+
# example: dev-sn-client
33+
SUBNET_CLIENT_NAME=""
34+
# example: 192.168.10.0/24
35+
SUBNET_CLIENT_IP_RANGE=""
36+
37+
## COMPUTE VM
38+
# example: dev-vm-client
39+
VM_NAME=""
40+
VM_IMAGE_FAMILY="windows-2022"
41+
VM_MACHINE_TYPE="e2-standard-4"
42+
43+
## CLOUD STORAGE
44+
# Storage bucket require a unique name across google. Enter your unique name below.
45+
# example: adb-sample-quickstart
46+
BUCKET_NAME=""

multicloud/gcloud-cli/config.default

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
4+
# update the values below to match your requirements
5+
# example: us-east4
6+
REGION=""
7+
PROJECT=""
8+
9+
## IDENTITIES
10+
# The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character
11+
# example: watchS0meMovies#
12+
USER_PASSWORD=""
13+
14+
## ADB properties
15+
# Database name. This will be used for the display name as well.
16+
ADB_NAME="quickstart"
17+
18+
# ADB IP range. It can not overlap with the client subnet range
19+
# example: 192.168.11.0/24
20+
SUBNET_DB_IP_RANGE=""
21+
22+
## NETWORKING
23+
# public client network
24+
# example: dev-network
25+
VPC_NETWORK_NAME=""
26+
27+
# names firewall rules
28+
VPC_FIREWALL_INGRESS_NAME="allow-common-ingress-ports"
29+
VPC_FIREWALL_EGRESS_NAME="allow-client-egress-ports"
30+
31+
# client subnet
32+
# example: dev-sn-client
33+
SUBNET_CLIENT_NAME=""
34+
# example: 192.168.10.0/24
35+
SUBNET_CLIENT_IP_RANGE=""
36+
37+
## COMPUTE VM
38+
# example: dev-vm-client
39+
VM_NAME=""
40+
VM_IMAGE_FAMILY="windows-2022"
41+
VM_MACHINE_TYPE="e2-standard-4"
42+
43+
## CLOUD STORAGE
44+
# Storage accounts require a unique name across google. Enter your unique name below.
45+
# example: adb-sample-quickstart
46+
BUCKET_NAME=""

0 commit comments

Comments
 (0)