How to build microservice which is based on OCI Function and ATP with Terraform

A lot of people around the world believe the serverless approach is the ultimate future of cloud computing. I am also such a believer, but it will be a gradual move, sort of evolution within the next couple of years. Some time ago I have published a blog about private endpoints for ATP.

Pic. Topology Diagram

I have used the code related to this blog post and I have refactored it a bit. The idea behind was to eliminate VM-based web server with Flask microservice. This old school technology could be replaced by OCI Function and API Gateway (btw. check Kranthi blog post). I guess this refactoring has been pretty successful. Below in this 15 minutes video, you will see my hard work on this topic. Hope it will be tasty πŸ™‚

Bon Appetit,

Martin, The Cook.

Subscribe to get access

For now video is blocked, but you can watch it immediately when you subscribe!

My thoughts after successful Oracle Cloud Infrastructure Developer 2020 Certified Associate exam

mattia_rossi_oci_certified_solution_architect_associate_2018Last week I was very busy so it was hard to find a few free cycles to write about it. Yes, I have passed recently Oracle Cloud Infrastructure Developer 2020 Certified Associate exam. Frankly speaking, it was obvious for me I need to do it. I am a hardcore developer here at FoggyKitchen, mostly with Terraform, but I am also writing a lot of stuff in Ansible for Oracle, for example, Ansible-Database-Migration-Tool (ADMT). You are probably curious if this certification is important and if it is worth spending time on it. Well… I guess it is. The modern world is changing like crazy. Especially now during the COVID-19 outbreak, which transforms business in an extremely fast way. I have heard that recently some big CEO has told that staying away from the cloud today would be like planing to extinct soon. Maybe this is too radical for me, but it gives a sense of mindset shift and technological revolution we are approaching today. I am not sure how it looks like at your place, but in my location, in Poland, after full lockdown, all educational activities have been moved from analog to digital. The teachers must deliver e-schooling via Zoom or on the other platforms. On the other hand, the shops are adapting very quickly to provide a nice and easy e-commerce experience with the delivery of all goodies at your footsteps in your house. For example, I was shocked it wasn’t possible to buy new shoes in the mall for my kids (full lockdown means malls are closed). The spring has approached and their feet were just bigger. There were no excuses. I have done it via e-shop…

And here is a big question. Who will build this brand new world of e-shops, e-schools, e-something, etc? There will be a massive need for cloud developers. The army of flexible programmers capable to utilize all of the features of the modern clouds. That is is why it is worth spending time on this topic – learn about OCI Event Services and OCI Functions,Β  explore OCI API Gateway, Oracle Kubernetes Engine (OKE), Β OCI Autonomous Databases andΒ  OCI Web Application Firewall (WAF). And of course, it is a good idea to get skills and hands-on experience with Terraform (here is my tutorial).

What do you think about it? I am very excited about your feedback in this field…

One more thing… Please remember to subscribe FoggyKitchen YT channel. πŸ™‚

Martin, The Cook.

How to clone ATP in OCI…

About the flexibility of ATP instances in OCI I have written so far two times. For the first time, it was just a short ride to show how it easy to create this autonomous database in OCI. For the second time, I have shown a new feature of ATP – Private Endpoint. It means ATP instance will be completely separated from the public Internet and visible exclusively in the private subnet. Today I will show you yet another feature of ATP. Now you can quickly clone ATP instance. You can do it in two different ways. The basic is just a clone from the existing instance. A more sophisticated clone is based on ATP automatic backups. In the video below you can watch both use-cases coded with Terraform. I hope it will be a tasty thing as previous recordings πŸ™‚

Bon Appetit,

Martin, The Cook.

 

Private Endpoints for OCI Autonomous Database

Pic. Topology Diagram for Private Endpoint for ATP

It is not the first blog post about ATP, but I think this one is even more interesting. For your information, a few days back at OCI Release Notes webpage I have found information about new features for OCI Autonomous DB offering. I am talking about Private Endpoints for ATP or ADW databases. This feature has been awaited for a very long time. Previously your ATP or ADW databases were available only via public IPs. Now you can nest them inside a particular VCN and subnet. It means your database will be available under private IP enclosed in your subnet’s CIDR. Of course, you need to prepare some Network Security Groups (NSG) on ATP/ADW level and VM level. Since that moment VM can connect to ATP/ADW with SQLNet connection via private IP. For testing purposes I have created small GitHub repo and below you can find a video about how to use that repo. I believe you will find this dish very delicious. πŸ™‚

Bon Appetit,

Martin, The Cook.

Subscribe to get access

For now video is blocked, but you can watch it immediately when you subscribe!

Dinner for tonight – ATP again :)

More then a year ago in this post, I have initiated OCI ATP provisioning topic. After a year I have rewritten the whole repo. Not only because HCL 0.12 is a formal standard now, and all Terraform code was outdated. I have done it also because I feel it is good in general to re-test everything and verify how it works nowadays. On the other hand, after my last course for Terraform, I have found myself confident enough to record videos for blog posts like this one. That is why you can also find a short movie below. πŸ™‚

Bon Appetit,

Martin, The Cook.

OCI’s ATP as a second dish

What is your first association in case of ATP term? For me? Hmmm… Adenosine triphosphate, the most energetic organic chemical which fuels up biological forms of life…? That was something I have learned in secondary school long, long time ago. Well… ok…Β  But here I will be talking about something different! I will try to make you familiar with brand new Oracle Cloud Infrastructure service called Autonomous Transaction Processing (ATP). This new PaaS offering means you can create a database with OLTP capabilities, within a couple of minutes. Most of the tasks are fully automated. Oracle use to define it as self-driven, autonomous, which means it will require minimal effort to maintain. As a developer, you can focus on your tables and data itself. I used to specify ATP as a database container. Additionally, it is possible to provision that autonomous database automatically with Terraform.

For that purpose, I have downloaded the code from Terraform OCI Provider examples, which was published as a part of Terraform OCI Provider GitHub repo. Of course, I have modified it a little bit and here is my small GitHub repo with examples.Β The first ATP database is here:

MacBook-Pro-Martin:FoggyKitchenATP martinlinxfeld$ more atp.tf
(...)
resource "oci_database_autonomous_database" "autonomous_database" {
  #Required
  admin_password           = "${random_string.autonomous_database_admin_password.result}"
  compartment_id           = "${var.compartment_ocid}"
  cpu_core_count           = "${var.autonomous_database_cpu_core_count}"
  data_storage_size_in_tbs = "${var.autonomous_database_data_storage_size_in_tbs}"
  db_name                  = "${var.autonomous_database_db_name}"

  #Optional
  display_name  = "${var.autonomous_database_display_name}"
  freeform_tags = "${var.autonomous_database_freeform_tags}"
  license_model = "${var.autonomous_database_license_model}"
}
(...)

For accessing ATP from outside, for example from SQLDeveloper I need to have wallet. This wallet will be stored locally on your computer as a file:

MacBook-Pro-Martin:FoggyKitchenATP martinlinxfeld$ more atp_wallet.tf
(...)

data "oci_database_autonomous_database_wallet" "autonomous_database_wallet" {
autonomous_database_id = "${oci_database_autonomous_database.autonomous_database.id}"
password = "${random_string.wallet_password.result}"
}

resource "local_file" "autonomous_database_wallet_file" {
content = "${data.oci_database_autonomous_database_wallet.autonomous_database_wallet.content}"
filename = "${path.module}/foggykitchen_atp_wallet.zip"
}
(...)

Next, I need to create the backup for ATP. Keep in mind it will be a manual backup (there is automated backup already included). This manual backup you can execute before the major change in data just to have additional protection. Then you can manually restore from that backup if something goes wrong with data change. For the purpose of that backup, you need to prepare an object storage bucket. Name of the bucket should be backup_<database_name>:

MacBook-Pro-Martin:FoggyKitchenATP martinlinxfeld$ more atp_backup.tf
data "oci_objectstorage_namespace" "autonomous_database_backup_namespace" {
}

resource "oci_objectstorage_bucket" "autonomous_database_backup_bucket" {
compartment_id = "${var.compartment_ocid}"
name = "${var.autonomous_database_backup_display_name}"
namespace = "${data.oci_objectstorage_namespace.autonomous_database_backup_namespace.namespace}"
}

resource "oci_database_autonomous_database_backup" "autonomous_database_backup" {
autonomous_database_id = "${oci_database_autonomous_database.autonomous_database.id}"
display_name = "${var.autonomous_database_backup_display_name}"
}

Of course, I have variables.tf as well, but you will find it in GitHub repo for this small project. Ok, everything seems to be ready so I can start “terraform apply” command. This is output…

ATP_under_provisioning_Terraform+CloudUI

And after 4-5 minutes we have that database up and running, but there is a small problem with initial manual backup. It has failed for some reason:

ATP_failed_backup

So let us connect to ATP with SQLDeveloper. Let’s do it just to fix the manual backup configuration according to the documentation’s section written here. Here is SQLDeveloper screenshot with the proper sequence:

SQLDeveloper_backup_config

Ok, so now manual backup should work fine. You can see that on the screenshot below. I have created another manual backup and it was successful:

ATP_with_successful_backup

Looks like the second dish is ready. I have added some flavoring, but the dish seems to be delicious. πŸ™‚ Go ahead and cook for yourself! πŸ™‚

Best,

MasterChef Martin.