Search Results for: business

Custom business insight using built-in AWS features

Custom business insight using built-in AWS features

Create dashboards easily using a Serverless framework

For the purpose of this article, we will get into the shoes of the owner of a newly created online casino. Our first game is roulette, and its backend is a serverless API on AWS. We will discover how we can get some metrics about our game.

Photo by Kay on Unsplash

The roulette API

Our API offers an endpoint that process players bets and returns a random integer between 0 and 36. You can achieve this really easily with a Serverless framework:

https://medium.com/media/c8ef1fddaefdd8a2a860a8b7108211c4/hrefhttps://medium.com/media/eb1d1a5b1c7495eb5463ca7c88207d15/href

Our code is ready, and you can deploy it by running:

serverless deploy —-stage staging –region eu-west-3

Find the API URL in the deployment logs, and start playing by querying the API:

export CASINO_URL=https://xxxxxxxxxx.execute-api.eu-west-3.amazonaws.com/staging/roulette
curl -X POST $CASINO_URL -d '{"bet":50,"number": 13}' -H 'Content-Type: application/json'
{"win":false,"result":12}

Great, we have a working casino and thanks to our advertising campaign, players are starting to use it. In order for us to drive our next decisions, we need some business insight. In particular, we would like to know how the bet value evolves with time in the day. Our engineering team is already busy building a poker game, so we need something really quick to set up.

Good news, everyone! You can create that kind of custom metric/dashboard on CloudWatch, and there is even a serverless plugin to automate it. You will see that we don’t even need to update our JavaScript code.

CloudWatch Metrics

Metrics are the fundamental concept in CloudWatch. A metric represents a time-ordered set of data points that are published to CloudWatch. Think of a metric as a variable to monitor, and the data points as representing the values of that variable over time. For example, the CPU usage of a particular EC2 instance is one metric provided by Amazon EC2. The data points themselves can come from any application or business activity from which you collect data. — documentation

In our case, we will create a custom metric: the bet value over time. We are already logging the request body, so here are our custom metric properties:

  • Filter pattern: { $.bet = * }
    The syntax uses JSON path to filter on logs that we want to use for our metric. In our case, we are interested in logs printing the request body (including the bet property).
  • Metric value: $.bet
    Still using a JSON path, defines what property you want to keep as the metric value: in our case the bet value.
  • Log group name: /aws/lambda/online-casino-staging-roulette
    This represents the source of data. We want our metric to show insight about our roulette game, but not about our new poker game. Also, don’t forget to update the stage in the name.

You can get more information about filter and pattern syntax here.

Serverless Plugin Metric

Like for almost everything, there is a serverless plugin to automate custom metrics creation. First, install it and we will append a few lines to our serverless.yml to create the metric:

npm install –save-dev serverless-plugin-metric

https://medium.com/media/15c7dcaa3bd377bd9576860c1e99619b/href

CloudWatch Dashboards

Now that we configured our data source, let’s create the dashboard. Append these lines into your serverless.yml:

https://medium.com/media/d2bf492923d6c75b478ce497e4198a75/href

A few notes:

  • You can add many widgets in a dashboard. Each widget is composed of a configuration and a list of metrics. The same configuration will be used for every metrics in the same widget.
  • The period property defines how often a value should be computed. Here we set 300 seconds (every 5 minutes).
  • The stat property let you choose how values should be aggregated. For our first graph, we want the average bet value, so we used Average. For the second, we want the number of bets and we used SampleCount. Lastly, we will display the total bet amount in the period using Sum. Other possibilities include Minimum, Maximum, and various percentiles.
  • Three different views are available:
    – “view”: “singleValue” displays a single value
    – “view”: “timeSeries” displays a line chart
    – “view”: “timeSeries”, “stacked”: true displays a stacked line chart
  • You can create your dashboard in CloudWatch console, and export widgets JSON definitions in the source tab when editing.

Result

After one hour of sending random values through the API, here is the result:

Our wonderful dashboard

Pretty good for the small amount of work required, don’t you think? Oh, and here is the pricing:

  • $3/dashboard/month
  • $0.30/metric/month

Which makes $3.30 per month for this dashboard.

Bonus: Using widgets outside the console

One last thing: we would like to share these graphs with the executive board of the casino. But giving them access to the CloudWatch console doesn’t seem like the thing to do. Well, you are lucky because there is an API for that: GetMetricWidgetImage. Instead of creating the dashboard in your serverless.yml, you can retrieve widget images from within a web app that the board has access to and you can keep the AWS console for engineers.

And voilà! Thank you for reading. Feel free to share your thoughts in the comments and happy dashboarding!


Custom business insight using built-in AWS features was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.

Blockchain Based Crowdfunding Bridges Gap Between Global Investors and Business

Blockchain Based Crowdfunding Bridges Gap Between Global Investors and Business

The way in which global business owners and shareholders engage continues to adapt to changing market forces, technologies and fiscal appetites, however, the need for strong, stable and transparent investment processes remains key to the success of any project. With counterparties often frustrated by a lack of transparency and accessibility, the need for a platform […]

The post Blockchain Based Crowdfunding Bridges Gap Between Global Investors and Business appeared first on Global Coin Report.

Banks and Big Businesses Scramble for Their Own Digital Cash

Banks and Big Businesses Scramble for Their Own Digital Cash

Last week Reuters reported that several of the world’s biggest banks have invested $50 million to “create a digital cash system to settle financial transactions”. It’s an on-going project, according to the report, involving the likes UBS, Credit Suisse, Barclays, and Deutsche Bank. Banks are being tight-lipped on the project, and it should be noted […]

The post Banks and Big Businesses Scramble for Their Own Digital Cash appeared first on AMBCrypto.

SBI Holdings is considering accepting investment from Ripple to promote Money Tap business

SBI Holdings is considering accepting investment from Ripple to promote Money Tap business

The partnership between Ripple and SBI is something that cannot be ignored when it comes to companies in the cryptospace that are making massive progress in terms of adoption. During a recent conference, SBI Holdings’ Yoshitaka Kitao revealed the company’s plans about its future with XRP, Money Tap, Japan, and Ripple. Money Tap is an […]

The post SBI Holdings is considering accepting investment from Ripple to promote Money Tap business appeared first on AMBCrypto.

Olympia gears up for Blockchain Summit; Join the leading Blockchain for Business event in Europe

Olympia gears up for Blockchain Summit; Join the leading Blockchain for Business event in Europe

Blockchain Summit London is Europe’s leading Blockchain for Business event, trusted by tech giants and start-ups alike in bringing together the major players in the blockchain for the business sector. Taking place on the 26th and 27th June 2019 at Olympia in London, Blockchain Summit London is the third event of 2019 in the Blockchain […]

The post Olympia gears up for Blockchain Summit; Join the leading Blockchain for Business event in Europe appeared first on AMBCrypto.

Mark Karpeles: My New Business Will ‘Make Japan Blockchain Leader’

Mark Karpeles: My New Business Will ‘Make Japan Blockchain Leader’

Gox Mark Karpeles

The former CEO of defunct cryptocurrency exchange Mt. Gox, Mark Karpeles, wants to start a new Blockchain business in Japan. Karpeles’ Blockchain Gift To Japan Those were the plans Karpeles reportedly told the press in comments June 5, as he appeals a conviction for data manipulation as part of the Mt. Gox legal proceedings. While details are sparse, the Associated Press (AP) claims he plans to use the “same computer technology” for the project, which Karpeles

The post Mark Karpeles: My New Business Will ‘Make Japan Blockchain Leader’ appeared first on Bitcoinist.com.

BCH Businesses Launch Development Fund for Bitcoin Cash

BCH Businesses Launch Development Fund for Bitcoin Cash

A Variety of BCH Businesses Launch a Development Fund for Bitcoin CashOn May 30, the FVNI Development Society in collaboration with Bitcoin.com, Bitcoincash.org, Electron Cash, Bitcoincash.com and a multitude of individuals and businesses in China launched a new fundraiser to support the software engineers who maintain the technical development of the Bitcoin Cash network. The goal for Phase One is to raise 800 BCH by August […]

The post BCH Businesses Launch Development Fund for Bitcoin Cash appeared first on Bitcoin News.