Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Play ButtonPause Button
Matt Hamilton
Matt Hamilton

Posted on

     

Intro to IBM Cloud Functions

IBM Cloud Functions are a "serverless" technology based on Apache Openwhisk hosted by IBM. They allow you to write code and deploy it without having to worry about hosting, operating systems.

Above is the first part of a series of live coding sessions on Twitch I've done exploring IBM Cloud functions and showing some simple examples.

Also available on Cinnamon at:https://www.cinnamon.video/watch?v=329436575563777372

Session recap

To start with you need an account on IBM Cloud.You can get a free account by signing up here.

You can either manage the Cloud functions through the IBM Cloud web portal, or you can use the command line interface (CLI). To install the CLI and Cloud Functions plugin, details are here:https://cloud.ibm.com/functions/learn/cli

There are four main constructs in Cloud Functions:

  • Actions
  • Sequences
  • Triggers-Rules

In this session, we mainly covered actions, which is where the code lives. IBM Cloud Functions is based onApache Openwhisk and offers a number of different runtimes: JS/NodeJS, Swift, Java, Python, Ruby, Go, PHP, .NET, Any language (Docker).

Openwhisk runtimes

Some simple examples of creating, updating, invoking and deleting an action in IBM Cloud Functions

A simple hello world function:

defmain(args):name=args.get("name","unknown")return{"message":f"Hello{name}!"}
Enter fullscreen modeExit fullscreen mode

Create an action:

% ic fn action create hello hello.pyok: created action hello
Enter fullscreen modeExit fullscreen mode

List actions:

% ic fn action list                             actions/Matthew.Hamilton1@ibm.com_dev/hello                                   private python:3.7
Enter fullscreen modeExit fullscreen mode

Invoke a function:

% ic fn action invoke hello-r{"message":"Hello unknown!"}
Enter fullscreen modeExit fullscreen mode

Update a function:

% ic fn action update hello hello.pyok: updated action hello
Enter fullscreen modeExit fullscreen mode

Delete a function:

% ic fn action delete hello         ok: deleted action hello
Enter fullscreen modeExit fullscreen mode

As usual all the code and examples here can be found in my Github repository for the show:

GitHub logo IBMDeveloperUK / ML-For-Everyone

Resources, notebooks, assets for ML for Everyone Twitch stream

ML for Everyone

ML For everyone is a live show broadcast on theIBM Developer Twitch channel every week at 2pm UK time.

The show is presented byMatt Hamilton and focusses on topics in and around machine learning for developers, with the odd smattering of random Python topics now and then.

Preview of show

Past shows






I hope you enjoyed the video, if you want to catch them live, I stream each week at 2pm UK time on the IBM Developer Twitch channel:

https://developer.ibm.com/livestream/

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Head of DevRel @ASIMOV_Protocol. Prev: @arbitrum, @protocollabs, @bittensor_, @Ripple, @IBMDeveloper. Interested in cryptocurrencies / blockchain / AI/ML.
  • Location
    Barbados
  • Education
    University of Bristol
  • Work
    Co-Founder at ASIMOV Protocol
  • Joined

More fromMatt Hamilton

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp