TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Cloud Naming Convention (2019)

43 pointsby etxmalmost 4 years ago

5 comments

ukokialmost 4 years ago
Resource types in the name is a pet peeve of mine. They should not be part of the name. An RDS instance can never be anything other than a database, no need for &#x27;database&#x27; or &#x27;db&#x27; or &#x27;rds&#x27; in the name. Likewise a Kubernetes cluster can never be anything other than a k8s cluster. It doesn&#x27;t need &#x27;cluster&#x27; suffix.<p>Terraform makes this redundancy especially obvious because you already include the type in any references to resources eg.<p>google_container_cluster.payments_cluster.something
评论 #27940139 未加载
评论 #27940621 未加载
评论 #27940246 未加载
评论 #27949392 未加载
FridgeSealalmost 4 years ago
I’d argue for having environment-if you do specify it in your resource name- should be at the start, and ideally capitalised differently: in the awful event you somehow find yourself in some kind of environment where dev and prod services are inexplicably listed together, you probably want it to be as clear as possible which one you’re accessing&#x2F;reading&#x2F;etc.<p>Personally I think applications should be blind to environment and have the relevant configs passed to them and said environments should be as well-separated as possible. Ideally in different accounts. With different URL’s. That are co-inaccessible.
aliswealmost 4 years ago
this falls when azure allows a-z0-9 hyphens and underscores on most resources, a-z and underscores (no hyphens or digits) on some resources, and on others, only a-z and like 20 characters.<p>that&#x27;s not a fault with the article, though.
评论 #27941099 未加载
gouggougalmost 4 years ago
The &quot;environment&quot; absolutely should _not_ be part of the name of the resource.<p>Coupling the notion of &quot;environment&quot; with your workload (be it in their name or their configuration files) is an anti-pattern that I wish people stopped following.<p>If you have 3 environments, dev staging and prod, you want resources in these environments to be named _exactly the same_ in each environment.<p>Whatever your workloads are, wherever they run, they themselves should never _be aware of the environment they run in_. From a workload&#x27;s point of view the &quot;environment&quot; and its label (dev, staging or prod) do not matter. What makes a workload a &quot;dev&quot; or a &quot;production&quot; workload are their respective configuration and the way they differ, _not_ the name of the &quot;environment&quot; they run in.<p>What makes a workload a &quot;dev&quot; workload is dictated by its configuration (which database host it talks to for example).<p>When the environment is being coupled in the configuration of your workloads, inevitably a developer will end up writing code like:<p><pre><code> if env == &#x27;dev&#x27; then use_database(&quot;dev.example.com&quot;) </code></pre> This won&#x27;t work at all at scale as people start adding new environments (imagine, &quot;qa&quot;,&quot;test&quot;, &quot;dev_1&quot;, &quot;alphonso&#x27;s_test&quot;, &quot;etc&quot;) as developer will start adding more and more conditions:<p><pre><code> if env == &#x27;dev&#x27; then use_database(&quot;dev.example.com&quot;) if env == &#x27;qa&#x27; then use_database(&quot;qa.example.com&quot;) if env == &#x27;dev_1&#x27; or env == &#x27;alphonso&#x27; then use_database(&quot;dev_00.example.com&quot;) &#x2F;&#x2F; ... add more and more and more conditions </code></pre> Instead, if your &quot;dev&quot; environment must talk to a &quot;dev.example.com&quot; database, create a variable called &quot;DATABASE_HOST&quot;.<p>And for each environment, set the &quot;DATABASE_HOST&quot; to the value of the database this specific environment needs to talk to.<p>For example, for your &quot;dev&quot; environment DATABASE_HOST = &quot;dev.example.com&quot;, and in your prod environment DATABASE_HOST = &quot;prod.example.com&quot;. Here we clearly have a &quot;dev&quot; and a &quot;prod&quot;, yet &quot;dev&quot; and &quot;prod&quot; are merely a &quot;labels&quot; for us humans to differentiate them, but the _configuration_ of these environments is really what defines them.<p>The code above then simply becomes:<p><pre><code> use_database(DATABASE_HOST) </code></pre> and _this_ ^ will scale with an infinite amount of environments.<p>_Configuration_ defines the &quot;environment&quot; _not_ the name of the environment.<p>edit: I realize the article is talking about your cloud provider resources and people might be running multiple &quot;environment&quot; resources in a single account. The above applies to &quot;workloads&quot; talking to these &quot;cloud provider resources&quot;, not to the resources themselves, since, of course, you can&#x27;t have 2 DBs named the same under one single account (obviously the names would collide).
评论 #27938960 未加载
评论 #27938971 未加载
评论 #27939378 未加载
评论 #27939629 未加载
评论 #27939053 未加载
评论 #27939072 未加载
评论 #27947206 未加载
评论 #27939612 未加载
pwrplus1almost 4 years ago
I was disappointed that this article was not about naming actual clouds.
评论 #27940843 未加载