February 8, 2018 By Belinda Vennam 2 min read

From new account to running code in 5 minutes with serverless Templates

Using Templates for IBM Cloud Functions, you can start building serverless apps in less than 5 minutes. Literally.

What is a Template?

IBM Cloud Functions has just released a catalog of Templates to help you jump start your next serverless application. Templates can be any combination of Actions, Triggers, and Sequences connected together to form a solution. With Templates, you can quickly and easily create actions and start coding right away. Some of the Templates will require service instances from IBM Cloud. There are different Templates available, from printing new item information whenever a new item is added to a Cloudant database to setting up a periodic trigger connected to slack.

Once you’ve deployed the Template, make your own edits to the provided code, and it will quickly become your own! You can go check out the catalog of available Templates or follow along with the instructions for creating your first Template below.

Deploying Templates in IBM Cloud Functions

  1. To create a template, go to IBM Cloud Functions in the console and click ‘Start Creating’.

  2. Click ‘Deploy Template’.

  3. Select the Template you would like to create. For now, let’s try out the ‘Get HTTP Resource’ template. This template will deploy an action to fetch an external resource — in this case the Yahoo Weather API — and then return data. You might want to use a pattern like this when building a backend for a web application, especially if the resource you’re accessing needs an API Key or credentials that you don’t want exposed in your front end app or if the resource is not CORS aware.

  4. The action is enabled as a Web Action, which allows it to be invoked via a URL without an authentication key. Check out the code, and then click ‘Deploy’.

  5. Once you’ve deployed the action, click the ‘Endpoints’ tab and copy the Web Action public URL. You can now paste that URL into your browser to see this action working.

  6. If you don’t pass in a parameter, the action will return the weather for Vermont since that is set in the code as the default. You could also provide a parameter with a location to get the weather for a different location:https://{APIHOST}/api/v1/web/{QUALIFIED ACTION NAME}?location=Austinhttps://{APIHOST}/api/v1/web/{QUALIFIED ACTION NAME}?location=Miami

  7. You should see the weather for your chosen location!  The action received the request from your browser, then made a call to the weather API, and returned with a response.

What’s Next?

We’re excited to see this catalog grow as we continue to add Templates that are useful to you. Is there something specific you would like to see created as a Template? Feel free to share in the comments below, or by reaching out directly to our team!

Learn more about IBM Cloud Functions


More from

How to build a successful risk mitigation strategy

4 min read - As Benjamin Franklin once said, “If you fail to plan, you are planning to fail.” This same sentiment can be true when it comes to a successful risk mitigation plan. The only way for effective risk reduction is for an organization to use a step-by-step risk mitigation strategy to sort and manage risk, ensuring the organization has a business continuity plan in place for unexpected events. Building a strong risk mitigation strategy can set up an organization to have a…

The software-defined vehicle: The architecture behind the next evolution of the automotive industry

4 min read - More and more consumers now expect their vehicles to offer an experience no different from that offered by other smart devices. They seek full integration into their digital lives, desiring a vehicle that can manage their operations, add functionality and enable new features primarily or entirely through software. According to a GMI report, the global software-defined vehicle (SDV) market is expected to achieve a CAGR of 22.1% between 2023 and 2032. This growth is driven by increasing demand for advanced…

Leveraging CISA Known Exploited Vulnerabilities: Why attack surface vulnerability validation is your strongest defense 

5 min read - With over 20,000 Common Vulnerabilities and Exposures (CVEs) being published each year1, the challenge of finding and fixing software with known vulnerabilities continues to stretch vulnerability management teams thin. These teams are given the impossible task of driving down risk by patching software across their organization, with the hope that their efforts will help to prevent a cybersecurity breach. Because it is impossible to patch all systems, most teams focus on remediating vulnerabilities that score highly in the Common Vulnerability…

Get ready for change with IBM Cloud Training

2 min read - As generative AI creates new opportunities and transforms cloud operations, it is crucial to learn how to maximize the value of these tools. A recent report from the IBM Institute for Business Value found that 68% of hybrid cloud users already have a formal, organization-wide policy or approach for the use of generative AI. That same report also noted that 58% of global decision makers say that cloud skills remain a considerable challenge. Being proactive in your learning can significantly…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters