Score:0

Cloud Run / Secret Manager Free Tier

va flag

I'm using Cloud Run for the backend of a project I'm working on, in part due to its generous free tier (2 million requests per month, free). But the services require some secret values (database password, Oauth secret key, etc.), so I have followed the Google recommendation to store these values in Google Secret Manager and load them as environment variables through Cloud Run.

However, the free tier of Secret Manager is much more restrictive, at only 10,000 free access operations per month. If cloud run spins up a container for nearly every request, it seems as though it must access secrets at approximately this rate too, drastically reducing the free tier quota.

So my question is, how should I set up the environment variables for my Cloud Run instance without destroying the free tier that made the platform so attractive in the first place? Simply putting the database password etc. in the environment variables seems like a bad idea, but it's unclear to me how much of a security risk that actually poses given that the project is a student website that doesn't contain any sensitive personal information in the database, and also given that a user with administrative access to the Google Cloud console could access the secret values from secret manager anyway.

Score:2
cn flag

Pay for Secret Manager. Those hardware security modules and compliance attestations to implement it are not free.

Or come up with a different solution. Different secret management software, less sophisticated store secrets in plain text files, different application deployment model. Which may not be compatible with exclusively using the managed Cloud Run product.

unclear to me how much of a security risk that actually poses given that the project is a student website that doesn't contain any sensitive personal information in the database

Possibly a small risk to your organization in the big picture, but being careless with secrets is a bad habit.

Every application, even small ones in a simple compliance environment, deserves some level of protection of secrets. At least restricted access configuration files. Definitely not embedded into application code.

a user with administrative access to the Google Cloud console could access the secret values from secret manager anyway.

Hiding data from authorized administrators is not the point of secret systems. Any access or deletion of secrets is logged. Which in theory enables catching disclosing these to an attacker, or use of old versions beyond the time when they were supposed to be rotated.

Score:1
st flag

To keep your costs low you need to figure out what the best approach is in order to keep your containers up or allow it to be shutting down.

In short, Cloud Run containers can be idle for up to 15 minutes before shutting down. Maximizing its up time tends to avoid extra requests to Secret Manager.

You can configure a monitoring system to send requests to your app every 10 minutes, in your most accessed hours, in order to keep your containers up, and send no requests in less accessed hours in order to leave it to shut down at night.

This way you can minimize containers starts and cold starts during business hours, and allowing them to shut down at night to save costs.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.