Other considerations
When using Cloud Functions, you should be aware of a couple of features and considerations. Let's have a look at these now.
Cloud SQL connectivity
As we mentioned previously, Cloud Functions is stateless and the state needs to be saved on external storage or in a database. This can be done with external storage such as Cloud Storage or a database such as Cloud SQL. In general, any external storage can be used. We introduced Cloud SQL in Chapter 3, Google Cloud Platform Core Services. To remind you, it is a managed MySQL, Postgres, or MS SQL database. With Cloud Functions, you can connect to Cloud SQL using a local socket interface that's provided in the Cloud Functions execution environment. It eliminates the need to expose your database to a public network.
Connecting to internal resources in a VPC network
If your function needs to access services within a VPC, you can connect to it directly by passing a public network. To do this, you need...