ねら~ITエンジニア雑記

やきうのお兄ちゃんが綴るOracle Databaseメインのブログ

Oracle Functions の Getting Started を試してみる。(Oracle Cloud Infrastructure)

OCI の Functions に Getting Started というメニューが追加されて、
Functions をお手軽に触れるようになってたので、お試しがてら触ってみましたやで彡(゚)(゚)

1. Oracle Functions とは?

Oracle Functions は Oracle Cloud Infrastructure(OCI) で利用可能な、
サーバーレス処理の実行環境です。他社サービスで言うと AWS Lambda などが 相当します。

Oracle Functionsの概念
https://docs.cloud.oracle.com/ja-jp/iaas/Content/Functions/Concepts/functionsconcepts.htm

Oracle Functionsに関するメモ
https://qiita.com/y-araki-qiita/items/f73f815ea60a93978cac

Oracle Functionsことはじめ
https://oracle-japan.github.io/paasdocs/documents/faas/oraclefunctions/handson/getting-started/

2. Compartment, VCN, Subnet の作成

Functions の前準備です。詳細は省略、過去記事や上記記事を参考にしてみてね彡(^)(^)

検証によく使う Oracle Cloud Infrastructure(OCI) の 環境構成(VCN, Seculity List, 各種Gateway, Route Table, Subnet, Compute)まとめ
https://qiita.com/ora_gonsuke777/items/08e4781af8c4f7e114ff

検証によく使う Oracle Cloud Infrastructure(OCI)環境を Terraform で作成してみる。
https://qiita.com/ora_gonsuke777/items/8651c4075ec6bf436c4f

3. Functions の作成

コンソールから Functions を作成します。Compartment, VCN, Subnet を指定してポチポチ…… WS000000.JPG

WS000001.JPG

4. Getting Started の進行

作成した Functions をクリックして画面遷移すると、Getting Started というメニューが表示されています。
これをクリックすると、基本コピペで実行可能なコマンド群が出てくるので、これらを実行していきます。
WS000002.JPG

WS000003.JPG

Local Setup と Cloud Shell Setup の 2種類が有りますが、今回は簡単そうな Cloud Shell で進行彡(゚)(゚)

Cloud Shell を起動して……
WS000004.JPG

ポチポチとコマンドをコピペで実行…… WS000006.JPG

OCIR(Oracle Cloud Infrastructure Registory) の部分だけ、少し修正

fn update context registry nrt.ocir.io/<tenancy-namespace>/[OCIR-REPO]
↓
fn update context registry nrt.ocir.io/<tenancy-namespace>/ays-func1

後は粛々とコピペ…… WS000007.JPG

デプロイは時間が掛かる。 WS000009.JPG

デプロイが完了したら、invokeオプションでデプロイした Functions を呼び出します。 WS000011.JPG

ayumu_shib@cloudshell:hello-java (ap-tokyo-1)$ fn invoke ays-functions1 hello-java
Hello, world!
ayumu_shib@cloudshell:hello-java (ap-tokyo-1)$ fn invoke ays-functions1 hello-java
Hello, world!
ayumu_shib@cloudshell:hello-java (ap-tokyo-1)$ 

Functions が動作したで!彡(^)(^)

5. まとめ

いちおう Functions をデプロイしてコールできたんやけど、
もう少し実践的な使い方をしたいなぁ……。引き続き模索していきたいですやね。彡(゚)(゚)