title: How do you stop using App Engine Flex Instance?
body: <p>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 :)</p>
  
  <p><a href="https://firebase.google.com/pricing/" rel="noreferrer">https://firebase.google.com/pricing/</a></p>
  
  <p>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.</p>
  
  <pre><code>'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 =&gt; {
  
      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;
        }
      });
    })
  </code></pre>
  
  <p>According to the transactions, I used</p>
  
  <ul>
  <li>App Engine Flex Instance RAM: 1932.033 Gibibyte-hours</li>
  <li>App Engine Flex Instance Core Hours: 1932.033 Hours</li>
  </ul>
  
  <p>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.</p>
  
  <p>Thank you!</p>