![]() |
Restore IBM Cloud Code Engine projects |
Henrik's thoughts on life in IT, data and information management, cloud computing, cognitive computing, covering IBM Db2, IBM Cloud, Watson, Amazon Web Services, Microsoft Azure and more.
Showing posts with label serverless. Show all posts
Showing posts with label serverless. Show all posts
Wednesday, April 3, 2024
Follow-up on resource reclamation: Search resources and Code Engine commands
Monday, May 9, 2022
A simple nginx deployment on IBM Cloud Code Engine
![]() |
HTML files as configmap in Code Engine |
Thursday, May 5, 2022
Custom domain for your serverless Code Engine app
![]() |
Output of a IBM Cloud Code Engine app |
Thursday, March 24, 2022
Blue-green deployment with IBM Cloud Code Engine and Knative
![]() |
Code Engine app with green revision |
Tuesday, June 15, 2021
Quickly deploy the serverless cloud mailer using Terraform
In the era of instant messaging we all still receive emails. They are used for status updates, security alerts or just for proposing really great offers. Recently, I blogged about how to have the IBM Cloud Security Advisor send out alerts using your SMTP-based email delivery service. Later, I made the solution core, a serverless action available as separate project "cloudmailer" on GitHub and blogged about it: A Serverless Function for Sending Emails on IBM Cloud. Continuing this side project, I now added Terraform support. Thus, using "terraform apply" you can now automatically deploy everything including the SMTP configuration. See the instructions in code repository for details.
Friday, May 28, 2021
IBM Cloud: Send out alert emails using SMTP
Last year, I blogged about how to use Slack or email notifications for security IBM Cloud security issues. Now I added another code sample, showing how to send out notification emails using any SMTP server. The code is written in Python and Node.js and deployed as IBM Cloud Functions-based webhook. The core part in charge of connecting to an SMTP email server and sending the email is isolated as dedicated action. Thus, it is possible to use it on its own, e.g., to send out emails unrelated to the IBM Cloud Security & Compliance Center.
Tuesday, March 30, 2021
cron-like scheduling on IBM Cloud
![]() |
cron-like scheduling |
Some days ago I stumbled over my 2015 post "Bluemix: Simple cron-like service for my Python code". It is not just the name Bluemix which is dated. Since then, it has transformed into IBM Cloud Platform and has added serverless compute options like IBM Cloud Functions (OpenWhisk) and recently IBM Cloud Code Engine. Both of them support "eventing", event-based execution of code. And both support Python code as well as many other programming languages like Node.js, Go (Golang), PHP and more. So, what does it take to set up cron-like scheduling? Not much.
Monday, April 20, 2020
All the best combined: Cloud, Db2, Python, Serverless and Security
![]() |
Add a cloud service ID as Db2 user |
All this helps to reduce the set of privileges held by a user or service and hence increases cloud security.
Thursday, March 12, 2020
How to: Slack or email notifications for IBM Cloud security issues
![]() |
Architecture for security notifications |
Wednesday, July 17, 2019
Rotating service credentials for IBM Cloud Functions
![]() |
Keep your service keys secret |
Monday, October 22, 2018
Automated reports with IBM Cloud Functions, Db2 and Slack
![]() |
GitHub Traffic Analytics |
Monday, July 16, 2018
Extended: Manage and interact with Watson Assistant from the command line
Remember my blog posts about how to manage Watson Assistant from the command line and how to test context for a conversation? Well, that tool did not work well for server actions which I used in this tutorial on building database-driven Slackbot. The good news is that I found time to extend my command line Watson Conversation Tool to support credentials for IBM Cloud Functions.
With the recent update to the tool there are two new features:
With the recent update to the tool there are two new features:
- Use the option "-outputonly" with the "-dialog" option to only print the output text, not the entire JSON response object. I introduced it to be able to demo dialog flows from the command line. Not everybody needs all the metadata for every dialog turn. Here is how it looks like when in action:
- In order to test dialog server actions, I need to provide the credentials for IBM Cloud Functions (ICF) in a private context variable. I recently blogged about how to enable the Watson botkit middleware for those server actions. For my tool, just provide the ICF key token as part of the configuration file. A sample is part of the GitHub repository.
![]() |
Chatbot dialog on the command line |
Thursday, May 24, 2018
How to pack serverless Python actions
![]() |
Serverless access to Db2 and GitHub |
Monday, April 23, 2018
Use Db2 and IBM Cloud to analyze GitHub traffic data (tutorial)
![]() |
Architecture: GitHub Traffic Analytics |
Tuesday, February 27, 2018
Security Details: Serverless database access within IBM Watson Conversation service
![]() |
Slackbot Architecture |
Thursday, February 15, 2018
Easy Database Setup the Serverless Way
![]() |
Serverless Slackbot with Db2 |
Thursday, January 25, 2018
Access Db2 from IBM Cloud Functions the Easy Way (Node.js)
Recently, I have been experimenting with the IBM Watson Conversation service and Db2. With a new feature in the conversation service it is possible to perform programmatic calls from a dialog node. Why not query Db2? I implemented both a Db2 SELECT and INSERT statement wrapped into actions of IBM Cloud Functions. It is quite easy and here is what you need to know.
The conversation service supports client-side and service-side calls. This means, either the application driving the chat can be instructed to make an outside call or the conversation service itself is invoking an action. That is, IBM Cloud Function actions can be called. For my experiment I coded up two actions, one to fetch data from a Db2 database, the other to insert new data. I chose Node.js 8 runtime platform because the Db2 driver for Node.js is already part of the runtime environment. The sources for the Db2-related actions are in this Github repository.
Passing the right values to the functions shouldn't be a problem for you. Obtaining the credentials for Db2 and making them available inside the action got simplified recently. The CLI plugin for IBM Cloud Functions allows to bind a service to an action as show here:
bx wsk service bind dashDB /hloeser/ConferenceFetch --instance henrikDB2 --keyname henriksKey2
In the example I am binding credentials for the dashDB service (that is Db2 Warehouse on Cloud) to one of my actions named "ConferenceFetch". Because I have multiple service instances and possibly multiple keys (credentials) I make use of the optional parameters "instance" and "keyname". Thereafter, the Db2 configuration including username and password is available in the action metadata. In the action code I am using this syntax to obtain the "dsn" information. The dsn is used by the Db2 driver to connect to the database.
__bx_creds: {dashDB:{dsn}}
With this rough outline you should be able to get your IBM Cloud Functions connected to Db2. Those actions can then directly be called from within a dialog node of Watson Conversation. I will post details on how that works in another blog entry.
If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn.
The conversation service supports client-side and service-side calls. This means, either the application driving the chat can be instructed to make an outside call or the conversation service itself is invoking an action. That is, IBM Cloud Function actions can be called. For my experiment I coded up two actions, one to fetch data from a Db2 database, the other to insert new data. I chose Node.js 8 runtime platform because the Db2 driver for Node.js is already part of the runtime environment. The sources for the Db2-related actions are in this Github repository.
Passing the right values to the functions shouldn't be a problem for you. Obtaining the credentials for Db2 and making them available inside the action got simplified recently. The CLI plugin for IBM Cloud Functions allows to bind a service to an action as show here:
bx wsk service bind dashDB /hloeser/ConferenceFetch --instance henrikDB2 --keyname henriksKey2
In the example I am binding credentials for the dashDB service (that is Db2 Warehouse on Cloud) to one of my actions named "ConferenceFetch". Because I have multiple service instances and possibly multiple keys (credentials) I make use of the optional parameters "instance" and "keyname". Thereafter, the Db2 configuration including username and password is available in the action metadata. In the action code I am using this syntax to obtain the "dsn" information. The dsn is used by the Db2 driver to connect to the database.
__bx_creds: {dashDB:{dsn}}
With this rough outline you should be able to get your IBM Cloud Functions connected to Db2. Those actions can then directly be called from within a dialog node of Watson Conversation. I will post details on how that works in another blog entry.
If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn.
Subscribe to:
Posts (Atom)