Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you stop using App Engine Flex Instance?

I'm using a free trial of Google Cloud and I'm almost halfway through the free credit. I don't know if I'm doing something wrong or if it just costs more than I expected, so I was looking at the pricing and realized I don't understand most of it. I'm just learning and having fun so I don't actually want to spend money (or at least not that much), so anything to help make the free credits last the year would be great :)

https://firebase.google.com/pricing/

What I did with my function is get information from Firebase Database for notifications and then send the notification using Firebase Messaging. Here's the code, if it helps.

'use strict';

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);

exports.sendNotifications = functions.database.ref('/Notifications/{pushID}/title')
  .onWrite(event => {

    if (!event.data.exists())
      return;

    event.data.ref.parent.once('value').then(function(dataSnapshot){

      // Grab the eventName and the message
      const title = dataSnapshot.child('title').val();
      const message = dataSnapshot.child('message').val();
      const recipients = dataSnapshot.child('recipients').val();
      const tag = dataSnapshot.child('tag').val();

      const payload = {
        notification:{
          title: title,
          body: message,
          tag: tag,
          color: "#51E0F5",
          sound: 'default'
        },
      };

      const options = {
        priority: 'high',
        collapseKey: 'chat',
        timeToLive: 3600    // 6 days
      };

      // Get rid of this Notification in Firebase
      event.data.ref.parent.remove();

      // Create notification
      if (recipients != null)
      {
        return admin.messaging().sendToDevice(recipients, payload, options);
      }
      else
      {
        return;
      }
    });
  })

According to the transactions, I used

  • App Engine Flex Instance RAM: 1932.033 Gibibyte-hours
  • App Engine Flex Instance Core Hours: 1932.033 Hours

How do I stop using App Engine Flex Instance? What is it? Or is it time to look for a replacement before they start charging my card.

Thank you!

like image 316
Katie Avatar asked Apr 04 '17 02:04

Katie


People also ask

Is App Engine always running?

App Engine attempts to keep manual and basic scaling instances running indefinitely. However, at this time there is no guaranteed uptime for manual and basic scaling instances.

What is instance in Google App Engine?

Instances are the computing units that App Engine uses to automatically scale your application. At any given time, your application can be running on one instance or many instances, with requests being spread across all of them.


1 Answers

You can stop all instances in flexible app engine by stopping the VERSION. I use this all the time for development - no sense in keeping things running overnight.

Go to your google cloud platform console, select app engine, then select version. Check the version you want to stop, and then click stop at the top. Note that you can't actually DELETE your last version, but you CAN stop it :) This shuts down all instances.

like image 186
KevinG Avatar answered Oct 10 '22 17:10

KevinG