<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Praveen Sharma on Medium]]></title>
        <description><![CDATA[Stories by Praveen Sharma on Medium]]></description>
        <link>https://medium.com/@pkjupiter29?source=rss-d0afbddd9209------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*z72dt6pHi_21Zdp_</url>
            <title>Stories by Praveen Sharma on Medium</title>
            <link>https://medium.com/@pkjupiter29?source=rss-d0afbddd9209------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 12:25:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pkjupiter29/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Title : OCI Observability and management — How to enable Database monitoring for Oracle Cloud…]]></title>
            <link>https://medium.com/@pkjupiter29/title-oci-observability-and-management-how-to-enable-database-monitoring-for-oracle-cloud-47e8295bb3d2?source=rss-d0afbddd9209------2</link>
            <guid isPermaLink="false">https://medium.com/p/47e8295bb3d2</guid>
            <dc:creator><![CDATA[Praveen Sharma]]></dc:creator>
            <pubDate>Mon, 05 Dec 2022 13:08:16 GMT</pubDate>
            <atom:updated>2022-12-06T11:05:27.638Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Title : OCI Observability and management — How to enable Database monitoring for Oracle Cloud Databases on OCI/on-prem/Other Cloud (AWS/Azure).</strong></h3><p><strong>OCI : This story cover the enabling of database monitoring for all Oracle databases on OCI. This blog post provides you a step-by-step guide to enable Database Management service for Oracle Cloud databases [Option 3].</strong></p><p><strong><em>Note</em></strong><em>:</em> The new release of Database Management service now supports Oracle Databases on Virtual Machine, Bare Metal, and Exadata Cloud Service in OCI without installing the Management Agent. Refer another story for enabling database monitoring on GCP//Azure etc and management via OCI Observability and management.</p><p><strong>Option 1: Monitoring of databases on On-premises, GCP, Azure:</strong></p><p>For databases running on OCI IaaS, ExaCC, on-premises, or other clouds, you need to install a Management Agent and register the database as External Database resource in the Database Management service.</p><p><strong>Option 2: Monitoring of Autonomous Databases on OCI:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*xcZKAOSrL2IOXpmL2E24Mg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*Mk7znJAVpVBLwRZPYyhHjw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*Vlgh0koSac2eWhnB9LVDyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*PaG3uXAVU_ecKMTu7k9DGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*JPoVt8hI76qouKuPWWHSSA.png" /></figure><p><strong>Option 3: Monitoring of Oracle Base Databases on OCI:</strong></p><blockquote>Follow the blog for step-by-step guide. This blog post provides you a step-by-step guide to enable Database Management service for Oracle Cloud databases [Option 3].</blockquote><p>Create any Base Database, we have chosen shape of VM type. Created database on Virtual Machine for demonstration purpose. Other valid options are Bare Metal or Exadata. While creating DB, keep a note of sys password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*XQZMxJK2bq4BkSGn5QS7kA.png" /></figure><p>Login to database via “ssh -I &lt;ssh-pvt-key&gt; opc@&lt;public-Ip&gt;” of your VM.1. Execute the following SQL:</p><blockquote>Note: We will be using dbsnmp user as authorized database user giving all required privileges to connect to OCI O&amp;M [Database Monitoring] to allow enabling of monitoring. We can create another user and authorize it.</blockquote><pre>[opc@vmdb1 ~]$ . oraenv<br>ORACLE_SID = [opc] ? VMDB1 <br><br>[opc@vmdb1 ~]$ sqlplus sys/&lt;your-password&gt; as sysdba<br>GRANT CREATE PROCEDURE TO dbsnmp;<br>GRANT SELECT ANY DICTIONARY, SELECT_CATALOG_ROLE TO dbsnmp;<br>GRANT ALTER SYSTEM TO dbsnmp;<br>GRANT ADVISOR TO dbsnmp;<br>GRANT EXECUTE ON DBMS_WORKLOAD_REPOSITORY TO dbsnmp;<br>/<br>Grant succeeded.<br>Grant succeeded.<br>Grant succeeded.<br>Grant succeeded.<br>Grant succeeded.<br><br>SQL&gt;  alter user dbsnmp account unlock;<br>User altered.<br><br>SQL&gt; alter user dbsnmp identified by &quot;Passw0r_$TOp&lt;&gt;0n@EE&quot;;     <br>User altered.<br>SQL&gt;</pre><p>Note: The above “DBSNMP” user password needs to be managed and accessed as vault secret.</p><p>Navigate to the Identity &amp; Security -&gt;Vault -&gt; Create Vault.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*MpchdM7Y6lL84qsblktUOQ.png" /></figure><p>Create the Vault Key (software type) before creating the vault through the Master Key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*CbzU2fbBbcw5XkRKu-VoTA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*64KrcnbKZT-AvGE7BcGEVA.png" /></figure><blockquote>Follow the oracle documentation to provide access to create and user secrets in the tenancy. Also allow Database management service via OIM Policy to enable communication between Database management and Oracle Cloud Database.</blockquote><p>Refer the Oracle Documentation for more detail — <a href="https://docs.oracle.com/en-us/iaas/database-management/doc/permissions-required-enable-database-management-oracle-cloud-databases.html">https://docs.oracle.com/en-us/iaas/database-management/doc/permissions-required-enable-database-management-oracle-cloud-databases.html</a></p><pre>Allow service dpd to read secret-family in compartment ABC<br>Allow service dpd to read secret-family in compartment ABC where target.vault.id = &#39;Vault OCID&#39;<br>Allow group DB-MGMT-ADMIN to manage secret-family in tenancy<br>Allow group DB-MGMT-ADMIN to manage virtual-network-family in tenancy<br>Allow group DB-MGMT-ADMIN to use security-lists in tenancy<br>Allow group DB-MGMT-ADMIN to use subnets in tenancy<br>Allow group DB-MGMT-ADMIN to use network-security-groups in tenancy<br>Allow group DB-MGMT-ADMIN to manage vnics in tenancy<br>Allow group DB-MGMT-ADMIN to manage dbmgmt-family in tenancy<br>Allow group DB-MGMT-ADMIN to use database-family in tenancy<br>Allow group DB-MGMT-ADMIN to read dbmgmt-work-requests in tenancy<br>Allow group DB-MGMT-ADMIN to manage dbmgmt-private-endpoints in tenancy<br>Allow service operations-insights to read secret-family in tenancy where ANY {target.secret.id=’VAULT Secret OCID’}</pre><p>Ensure that NSG and Security List are enabled for Database port 1521 to allow incoming connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*vvJEMFwRkp4z1v-7XIuGVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*aLToRSZJyHwv_sW9xQ2lWA.png" /></figure><p>Create Private Endpoint for Database to enable communication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*0Iue0l482DF7Zz41cgCsPw.png" /></figure><blockquote>Enable the Database Monitoring now</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*_TKntDKo95oeOI7Q3VwJdA.png" /></figure><p>After enabling the Database management services, you can see the db metrics:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*bCbM_MuFLEKlMUjNy93Jig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*6hC2CGBjLTb49tT-m0VgtA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*g0nAat0ciFuogLxvfAXpKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*9ZYgi0Yk7o4jy_SzrK1Ocg.png" /></figure><p>ADD your database for enabling Operational Insight</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*URzYvqRmFexvwyrwwyajGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*-9JY5s7ZqBqpClq-NJmlgA.png" /></figure><p>Add OIM Policy for service Operations-insights</p><p>e.g. Allow service operations-insights to read secret-family in tenancy where ANY {target.secret.id=’VAULT_OCID’}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*KqK_qbRMvx4uKDcyAD_mHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*Nv5MOMfaU3U19zrgRiHpPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*W57x1p3Nq8WJhaK6GSAuHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*A1GR-1L6fQiAmJhOd_1Iew.png" /></figure><p>For Database AWR snapshot, first Operations Insights Warehouse need to be created as shown below inside the AWR Hub:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*NSQtProMzhkpCFWGjxjAeQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*y31kGs0r2a_uGjugLO9dZA.png" /></figure><p>Create Object Storage and configure source Db like VMDB1 to send AWR snapshots to the AWR Hub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*zQsWxeU-VKoMISpA5HOX1w.png" /></figure><p>Create Object Storage Bucket and configure VMDB1 database to send the AWR snapshop to the Object Storage Bucket and from there it will get imported to AWR Hub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*L-zoxY2eEDe8e-D7zE3tIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*kzIJMZjWS9fCtgFX1v0gZw.png" /></figure><p><strong>Configuring your AWR Hub</strong></p><ol><li>Create the warehouse and AWR Hub: You can set up the AWR Hub from the Operations Insights console. The AWR Hub is an Oracle autonomous data warehouse created in the Operations Insights services tenancy. The Oracle Autonomous Database service can provide an SQL interface as a processing layer to analyze the AWR data.</li><li>Configure a data lake centered on Oracle Cloud Infrastructure Object Storage: All the AWR data from the source databases are ingested into OCI Object Storage service, then processed or transformed and loaded to the AWR Hub Warehouse created in step 1. Configure the AWR data from the source database to upload to an Object Storage bucket that resides in your tenancy. Before that, define cross-tenancy policies that allow the AWR Hub to pull AWR snapshots from OCI Object Storage.</li><li>Configure the source databases to upload AWR snapshots to AWR Hub: For any source database uploading AWR snapshots to AWR Hub, you need to register that database with the AWR Hub. You register the database by running the PL/SQL scripts provided in the Operations Insights AWR Hub registration page.</li><li>Create an Operations Insights warehouse database user: Create a warehouse database user with read-only access and access to the PL/SQL packages to run queries on the AWR tables. These permissions enable long-term analysis of AWR data across databases without impacting performance or storage on the source database targets.</li></ol><blockquote><strong>Troubleshooting Error while enabling the Database Monitoring:</strong></blockquote><blockquote>OCI Error: Operation failed because password secret is not accessible by Database Management.</blockquote><pre>Error: Operation failed because password secret is not accessible by Database Management.<br>First checkout the following policies in place :<br><br>• Allow service dpd to read secret-family in compartment ABC where target.vault.id = &#39;Vault OCID&#39;<br>• Allow group DB-MGMT-USER to read secret-family in compartment ABC where target.vault.id = &#39;Vault OCID&#39;<br>• Allow group DB-MGMT-ADMIN to manage secret-family in tenancy</pre><blockquote>OCI Error : The network adapter could not establish the connection. Check and update the system’s network security groups or security lists, then try again.</blockquote><pre>Error: The network adapter could not establish the connection. Check and update the system&#39;s network security groups or security lists, then try again.<br><br>Make sure ingress rules are in place. Please check the security list and NSG group as shown below and add them if they are not in place.<br><br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*aLToRSZJyHwv_sW9xQ2lWA.png" /></figure><h4><strong><em>Disclaimer: The views expressed on this document are my own and do not necessarily reflect the views of Oracle.</em></strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47e8295bb3d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OCI : How to automate Oracle Cloud Infrastructure with Terraform]]></title>
            <link>https://medium.com/@pkjupiter29/oci-how-to-automate-oracle-cloud-infrastructure-with-terraform-df5cd11a1a64?source=rss-d0afbddd9209------2</link>
            <guid isPermaLink="false">https://medium.com/p/df5cd11a1a64</guid>
            <dc:creator><![CDATA[Praveen Sharma]]></dc:creator>
            <pubDate>Tue, 29 Nov 2022 00:16:03 GMT</pubDate>
            <atom:updated>2022-12-05T18:09:00.314Z</atom:updated>
            <content:encoded><![CDATA[<h3>Title: OCI - How to create compute instance in Oracle Cloud Infrastructure with terraform on OCI Gen2</h3><blockquote>OCI : Automate Infrastructure Build with terraform on OCI Gen2.</blockquote><h4>Table of Content :</h4><p>Sign Up for Oracle Cloud Free Tier — Get your access sorted on OCI Tenancy.</p><p>[1] Sign Up for Oracle Cloud Free Tier — <a href="https://www.oracle.com/uk/cloud/free/">Signup for Free</a></p><p>[2] Install and setup the Terraform and OCI-CLI command line on your machine.</p><p>[3] Ensure the terraform and oci version are installed and working fine.</p><p>[4] Initialize the terraform and navigate through the plan followed by apply process to create the oci instance with terraform.</p><p><strong>Install terraform on Linux</strong></p><pre># terraform --version<br>Run the below command in your terminal to install terraform.<br># brew install terraform<br>Verify terraform installation?<br># terraform version<br><br>How to Install Terraform on Linux? <br># sudo apt-get update &amp;&amp; sudo apt-get install -y gnupg software-properties-common curl<br># curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -<br># sudo apt-add-repository &quot;deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main&quot;<br># sudo apt-get update<br># sudo apt-get install terraform<br><br>How to check the terraform version after installation?<br># terraform --version <br><br>If stuck, please follow the install video for more details. <br># https://developer.hashicorp.com/terraform/tutorials/oci-get-started/install-cli<br><br></pre><h4><strong>Install OCI CLI</strong></h4><pre>How to Install oci-cli on Mac? <br>brew update &amp;&amp; brew install oci-cli<br>brew update &amp;&amp; brew upgrade oci-cli<br><br>How to Install oci-cli on Linux? <br>bash -c &quot;$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)&quot;<br><br>How to check the oci-cli version after installation?<br>oci --version<br><br></pre><pre># oci setup config<br><br>Or <br><br>Login to Tenancy and create Auth Token and generate Fingerprint. <br>e.g.<br><br>Generating an SSH Key Pair for Oracle Compute Cloud Service Instances<br>https://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/compute-iaas/generating_ssh_key/generate_ssh_key.html<br><br>======================================<br>How to generate SSH Key pair for OCI :<br>======================================<br># ssh-keygen -b 2048 -t rsa<br>enerating public/private rsa key pair.<br>Enter file in which to save the key (/Users/user_name/.ssh/id_rsa): &lt;Enter&gt;<br>Enter the passphrase : : &lt;Enter&gt;<br><br>The above command generates an SSH key pair consisting of a public key and a private key, and saves them in the specified path.<br>SSH Public Key will be  : /Users/user_name/.ssh/id_rsa.pub<br>SSH Private key will be : /Users/user_name/.ssh/id_rsa<br><br>==================================<br>How to create OCI API Signing Key [.PEM Format] :<br>================================<br>To generate the key with no passphrase:<br># cd $HOME/.oci<br># openssl genrsa -out ~/.oci/oci_api_key.pem 2048                        <br># chmod go-rwx ~/.oci/oci_api_key.pem               <br> <br>Generate the public key from your new private key:<br># openssl rsa -pubout -in ~/.oci/oci_api_key.pem -out ~/.oci/oci_api_key_public.pem             <br> <br>Copy the contents of the public key to Tenancy to setup API connectivity<br>#  cat ~/.oci/oci_api_key_public.pem <br><br>Follow the Oracle documentation:<br>https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#five<br><br><br>Copy the contents of the public key to Tenancy to setup API connectivity<br>e.g. cat $HOME/.oci/config<br><br>Note: Tenancy account owner need to create config file inside $HOME/.oci and replace the following values with your actual values.<br><br># cat $HOME/.oci/config<br>————————————<br>[DEFAULT]<br>user=Tenancy_owner_used_ocid<br>fingerprint=Account_owner_FingerPrint<br>tenancy=Account_owner_Tenancy_OCID<br>region=Account_owner_Home_Region<br>key_file=Account_owner_API_OCI_private_key_location <br><br><br>Once OCI config file is setup then execute the following oci command to verify the OCI API key setup has been properly setup.  If you get any 404 Authentication, then please fix them before you move to next section. All of the below command should not return any error if they don’t render any output. <br><br># oci os ns get        <br># oci iam compartment list<br># oci compute instance list --compartment-id &lt;Account_owner_Tenancy_Compartment_ID&gt;<br># oci os ns get --compartment-id &lt;Account_owner_Tenancy_Compartment_ID&gt;</pre><p><strong>Once the above setup is being done, we are good to initialize the terraform and navigate through the plan followed by apply process to create the oci instance with terraform.</strong></p><pre>Note: We need to create terraform file for initializing variables, subnets, security list, Route rules, instance etc. All these files are of .tf types. <br><br><br># mkdir $HOME/oci_provider/<br># cd $HOME/oci_provider<br>Ensure to copy all the following [.tf] files and edit them and modify the required values as specified mostly with &quot;&lt; &gt;&quot; and once all fully checked then follow the next steps of terraform init. <br><br># cat variable.tf<br>variable &quot;tenancy_ocid&quot; {<br> default=&quot;&lt;OCI Tenancy Owner OCID&gt;&quot;<br> description=&quot;OCI Personal Tenancy -- No worries&quot; <br>}<br><br>variable &quot;user_ocid&quot;  {<br> default = &quot;OCI Personal Tenancy Owner OCID”<br>}<br><br>variable &quot;private_key_path&quot; {<br> default = &quot;Location of your private API file e.g. $HOME/oci_api_key.pem&quot;<br>}<br><br>variable &quot;ssh_public_key_file&quot; {<br>  default = “Location of your OCI SSH file e.g. $HOME/.ssh/id_rsa.pub&quot;<br>}<br><br>variable &quot;fingerprint” {<br> default = &quot;Account_owner_fingerprint&quot;<br>}<br><br>variable &quot;compute_cpus&quot; {<br> type = string<br> default = &quot;1&quot; <br>}<br><br>variable &quot;compute_memory_in_gbs&quot; {<br> type = string<br> default = &quot;1&quot;<br>}<br><br><br>variable &quot;cpu_core_count&quot; {<br>  type    = number<br>  default = 1<br>}<br><br>variable &quot;data_storage_size_in_gb&quot; {<br>  type    = number<br>  default = 1<br>}<br><br>variable &quot;db_name&quot; {<br> default = &quot;Choice_your_database_name&quot;<br>}<br><br>variable &quot;db_version&quot; {<br>     default = &quot;21c&quot;<br>}<br><br>variable &quot;license_model&quot; {<br> default = &quot;LICENSE_INCLUDED&quot; <br>}<br><br>variable &quot;admin_password&quot; {<br>        default = &quot;Any_password_you_like&quot;<br>}<br><br>variable &quot;is_free_tier&quot; {<br>        default = &quot;true&quot;<br>}<br><br>variable &quot;db_workload&quot; {<br> default = &quot;DW&quot;<br>}<br><br>variable &quot;ad_number&quot; {<br>    default = &quot;1&quot;<br>}<br><br>variable &quot;region&quot; {<br> default = &quot;Account_owner_home_region e.g. us-ashburn-1&quot;<br>}<br><br>variable &quot;root_compartment_id&quot; {<br> default = &quot;Account_owner_compartment_ocid&quot;<br>}<br><br>variable &quot;compartment_display_name&quot; {<br> default = &quot;Choice_of_any_compartment_name&quot;<br>}<br><br>variable &quot;public_subnet_name&quot; {<br>        default = &quot;Choice_of_any_subnet_name&quot;<br>}<br><br>variable  &quot;label_prefix&quot; {<br> default = &quot;none&quot;<br>}<br><br>/*<br>variable &quot;tags&quot; {<br>  description = &quot;simple key-value pairs to tag the resources created using freeform tags.&quot;<br>  type   = map(any)<br>  default = {<br>    environment = &quot;testing&quot;<br>    project = &quot;test-first-phase&quot;<br>  }<br>}<br>*/<br><br>variable &quot;instance_shape&quot; {<br>    default = &quot;Shape_of_your_choice-that-comes-for-free_tier&quot;<br>}<br><br><br>variable &quot;vcn_name&quot; {<br>  description = &quot;user-friendly name of to use for the vcn to be appended to the label_prefix&quot;<br>  type        = string<br>  default = &quot;testing&quot;<br>}<br><br>variable &quot;vcn_dns_label&quot; {<br>  description = &quot;A DNS label for the VCN, used in conjunction with the VNIC&#39;s hostname and subnet&#39;s DNS label to form a fully qualified domain name (FQDN) for each VNIC within this subnet&quot;<br>  type        = string<br>  default = &quot;ocitesting&quot;<br>}<br><br>variable &quot;vcn_cidr&quot; {<br>  description = &quot;cidr block of VCN&quot;<br>  default     = &quot;10.0.0.0/16&quot;<br>  type        = string<br>}<br><br>variable &quot;sub_cidr&quot; {<br>  default     = &quot;10.0.1.0/22&quot;<br>  }<br><br>variable &quot;internet_gateway_enabled&quot; {<br>  type = bool<br>  default = &quot;true&quot;<br>}<br><br>variable &quot;test-ports&quot; {<br>  default = [22,80,443]<br>}<br><br>variable &quot;worker_ol_image_name&quot; {<br>  default = &quot;Oracle-Linux-8-2022.10.04-0&quot;<br>}</pre><pre># cat provider.tf <br><br>provider &quot;oci&quot; {<br>  tenancy_ocid     = var.tenancy_ocid<br>  user_ocid        = var.user_ocid<br>  private_key_path = var.private_key_path<br>  fingerprint      = var.fingerprint<br>  region           = var.region<br>}</pre><pre># cat internet_gateway.tf<br><br>resource &quot;oci_core_internet_gateway&quot; &quot;ig&quot; {<br>    compartment_id = var.root_compartment_id<br>    vcn_id = oci_core_vcn.testvcn.id<br>    enabled = var.internet_gateway_enabled<br>    display_name = &quot;ig-test&quot;<br>}<br></pre><pre># cat vcn.tf <br><br>resource &quot;oci_core_vcn&quot; &quot;testvcn&quot; {<br>  cidr_block     = var.vcn_cidr<br>  compartment_id = var.root_compartment_id<br>  display_name   = var.label_prefix == &quot;none&quot; ? var.vcn_name : &quot;${var.label_prefix}-${var.vcn_name}&quot;<br>  dns_label      = var.vcn_dns_label<br>}</pre><pre># cat subnet.tf <br><br>resource &quot;oci_core_subnet&quot; &quot;subnet1&quot; {<br>    cidr_block = var.sub_cidr<br>    compartment_id = var.root_compartment_id<br>    vcn_id = oci_core_vcn.testvcn.id<br>    display_name = &quot;Anyname-subnet&quot;<br>    route_table_id = oci_core_route_table.rt.id<br>    security_list_ids = [oci_core_security_list.sl.id]<br>}</pre><pre># cat instance.tf <br><br>data &quot;oci_core_images&quot; &quot;ubuntu-18-04&quot; {<br>  compartment_id = var.root_compartment_id<br>  operating_system = &quot;Canonical Ubuntu&quot;<br>  filter {<br>    name = &quot;display_name&quot;<br>    values = [&quot;^Canonical-Ubuntu-18.04-([\\.0-9-]+)$&quot;]<br>    regex = true<br>  }<br>}<br><br>output &quot;show_image&quot; {<br>  value = data.oci_core_images.ubuntu-18-04.images[0].id<br>}<br><br>data &quot;oci_identity_compartments&quot; &quot;GetCompartments&quot; {<br> compartment_id = &quot;${var.tenancy_ocid}&quot;<br> filter {<br>  name = &quot;name&quot;<br> values = [&quot;{var.compartment_display_name}&quot;]<br> }<br>}<br><br>output &quot;showCompartment&quot; {<br>  value = data.oci_identity_compartments.GetCompartments<br>}<br><br><br>data &quot;oci_identity_availability_domains&quot; &quot;GetAds&quot; {<br> compartment_id = var.root_compartment_id <br>}<br><br>output &quot;show_ads&quot; {<br>  value = data.oci_identity_availability_domains.GetAds.availability_domains[0].name <br>}<br><br><br><br>resource &quot;oci_core_instance&quot; &quot;logging&quot; {<br>    availability_domain = data.oci_identity_availability_domains.GetAds.availability_domains[0].name<br>    compartment_id = var.root_compartment_id<br>    shape = var.instance_shape<br>    metadata = { <br>  ssh_authorized_keys = file(&quot;Replace_with_your_ssh_public_key_file_absolute_path&quot;) <br> }<br> shape_config {<br>      ocpus = var.compute_cpus<br>      memory_in_gbs = var.compute_memory_in_gbs<br>   }<br>    create_vnic_details {<br>  subnet_id = oci_core_subnet.subnet1.id<br>  assign_public_ip = true<br> }<br> source_details {<br> source_id  = data.oci_core_images.ubuntu-18-04.images[0].id<br> source_type = &quot;image&quot;<br> boot_volume_size_in_gbs = &quot;60&quot;<br> }<br> preserve_boot_volume = false<br>}<br><br><br>output &quot;instance_compute_id&quot; {<br>  value = oci_core_instance.logging.id<br>}<br><br>output &quot;instance_compute_state&quot; {<br>  value = oci_core_instance.logging.state<br>}<br><br>output &quot;instance_compute_public_ip&quot; {<br>  value = oci_core_instance.logging.public_ip<br>}</pre><pre>cat security.tf<br> <br>resource &quot;oci_core_security_list&quot; &quot;sl&quot; {<br>    compartment_id = var.root_compartment_id<br>    vcn_id = oci_core_vcn.testvcn.id<br>    display_name = &quot;sl-test&quot;<br>    <br>    egress_security_rules {<br>        destination = &quot;0.0.0.0/0&quot;<br> destination_type = &quot;CIDR_BLOCK&quot;<br>        protocol = &quot;all&quot;<br> stateless = false<br>    }<br>    ingress_security_rules {<br>     stateless   = false<br>     source      = &quot;0.0.0.0/0&quot;<br>     source_type = &quot;CIDR_BLOCK&quot;<br>     protocol    = &quot;6&quot;<br>     tcp_options {<br>      min = 22 <br>      max = 22 <br>     }<br>   }<br>   ingress_security_rules {<br>     stateless   = false<br>     source      = &quot;0.0.0.0/0&quot;<br>     source_type = &quot;CIDR_BLOCK&quot;<br>     protocol    = &quot;1&quot;<br>     icmp_options {<br>      type = 3<br>      code = 4<br>     }<br>   }<br>}<br><br><br>output &quot;public_security_list_id&quot; {<br>  value = oci_core_security_list.sl.id<br>}<br><br>output &quot;public_subnet_id&quot; {<br>  value = oci_core_subnet.subnet1.id<br>} <br></pre><pre># cat route.tf <br><br>resource &quot;oci_core_route_table&quot; &quot;rt&quot; {<br>    compartment_id = var.root_compartment_id<br>    vcn_id = oci_core_vcn.testvcn.id<br>    display_name = &quot;rt-test&quot;<br>    route_rules {<br>        destination = &quot;0.0.0.0/0&quot;<br>        destination_type = &quot;CIDR_BLOCK&quot;<br>        network_entity_id = oci_core_internet_gateway.ig.id<br>    }<br>}</pre><pre>Initialize the terraform now!<br><br># terraform init <br><br>Initializing the backend...<br><br>Initializing provider plugins...<br>- Reusing previous version of hashicorp/oci from the dependency lock file<br>- Using previously-installed hashicorp/oci v4.100.0<br><br>╷<br>│ Warning: Additional provider information from registry<br>│ <br>│ The remote registry returned warnings for registry.terraform.io/hashicorp/oci:<br>│ - For users on Terraform 0.13 or greater, this provider has moved to oracle/oci. Please update your source in required_providers.<br>╵<br><br>Terraform has been successfully initialized!</pre><pre>Execute the terraform plan now!<br><br><br># terraform plan<br><br>data.oci_identity_availability_domains.GetAds: Reading...<br>data.oci_identity_compartments.GetCompartments: Reading...<br>data.oci_core_images.ubuntu-18-04: Reading...<br>data.oci_identity_availability_domains.GetAds: Read complete after 0s [id=IdentityAvailabilityDomainsDataSource-134813681]<br>data.oci_identity_compartments.GetCompartments: Read complete after 0s [id=IdentityCompartmentsDataSource-134813681]<br>data.oci_core_images.ubuntu-18-04: Read complete after 0s [id=CoreImagesDataSource-1306275226]<br><br>Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:<br>  + create<br><br>Terraform will perform the following actions:<br><br># oci_core_instance.logging will be created<br># oci_core_internet_gateway.ig will be created<br># oci_core_route_table.rt will be created<br># oci_core_security_list.sl will be created<br># oci_core_subnet.subnet1 will be created<br># oci_core_vcn.testvcn will be created</pre><pre>Execute the terraform apply now!<br><br><br># terraform apply<br><br>Do you want to perform these actions?<br>  Terraform will perform the actions described above.<br>  Only &#39;yes&#39; will be accepted to approve.<br><br>  Enter a value: yes<br><br></pre><pre><br><br>Login to instance with OCI ssh private key and instance public IP<br><br># ssh -I &lt;Your_oci_ssh_pvt_key&gt; opc@&lt;Your_Instance_Public_IP_Address&gt;</pre><blockquote><strong><em>Disclaimer: The views expressed on this document are my own and do not necessarily reflect the views of Oracle.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df5cd11a1a64" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>