App Engine Flashcards

1
Q

What are some of the handy built in features GAE provides?

A
  • Turn-key support for many languages
  • Built-in scaling system
  • Easy deployment of apps via GIT
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What command do you need to run to create a new project on GAE?

A

gcloud app create –project=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What command do you need to run to install Python on GAE?

A

gcloud components install app-engine-python

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the files needed to make an app on GAE?

A
  • app.yaml
  • requirements.txt
  • main.py
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is for app.yaml file for?

A

General configuration file for the application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is for requirements.txt file for?

A

Specifies modules/libraries to install in the environment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is for main.py file for?

A

The backend application code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What command do you need to deploy your app on GAE?

A

gcloud app deploy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What command do you need to open your app on a new browser?

A

gcloud app browse

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What happens to instances when your app is idle?

A

They get spun down

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the ways we can implement a DB as part of our app?

A
  • Use a file-based DB (SQLite)
  • Use Datastore
  • Use Google Cloud Storage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the cons of using a file-based DB such as SQLite

A

Not persistent

Every new instance starts back a 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why might you use a file-based DB such as SQLite

A

If youre working with static non changing content

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Google Datastore?

A

A NoSQL Database

Deals with keys & values instead of tables & rows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the steps to use google datastore?

A
  1. Import it
    from google.cloud import datastore
  2. Create new Client object
    datastore_client = datastore.Client()
3. Add module to requirements.txt
google-cloud-datastore==2.1.6
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you write to google datastore?

A
  1. Create entity
    entity = datastore.Entity(key=myClient.key(‘hello’))
  2. Update entity
    entity. update({‘myVal’: ‘world’})
  3. Write the entity back to the datastore
    myClient.put(entity)
17
Q

How do you fetch from google datastore?

A

entity = myClient.get(‘hello’)

return entity[‘myVal’] # should return ‘world’

18
Q

What DB do you use to store files?

A

Google Cloud Storage

19
Q

How does Google Cloud Storage work?

A

You can a bucket for your app that can be used to store and serve files your your app

20
Q

What are the steps to use google cloud storage?

A
1. Import the module and create a client object
from google.cloud import storage
client = storage.Client()
  1. Fetch bucket ID
    from google.appengine.api import app_identity
    import os
    buckid = os.environ.get(‘BUCKET_NAME’, app_identity.get_default_gcs_bucket_name())
21
Q

How do you fetch from google cloud storage?

A
  1. Fetch bucket
    bucket = client.get_bucket(buckid)
  2. Fetch blob of data
    blob = bucket.get_blob(‘/my/lovely/file.txt’)
  3. fetch bytes from blob
    data = blob.download_as_bytes()
22
Q

What does the Client() function do?

A

Return a Client object that can be used to make subsequent calls to the Datastore

23
Q

What are the 3 ways to split traffic?

A
  • IP address
  • Cookie
  • Random
24
Q

By default, where does google redirect traffic?

A

To the newest version of the app

25
Q

What are the types of environment variables?

A
  • GAE_INSTANCE

- GAE_VERSION

26
Q

What does te getenv function do?

A

Fetches an environment variable

27
Q

What does os.getenv(‘GAE_INSTANCE’) return?

A

The instance that we are communicating with

28
Q

What does os.getenv(‘GAE_VERSION’) return?

A

The current version of the application that you are interfacing with

29
Q

What are the 2 different environments in GAE?

A
  • Standard

- Flexible

30
Q

What are the cons of using a flexible environment?

A
  • Can’t scale down to 0 instances
  • Longer boot times
  • Pricing based on compute instance characteristics