简体   繁体   English

AWS-环境变量

[英]AWS - Environment Variables

I would think this would be a very common question, but apparently it's not. 我认为这将是一个非常普遍的问题,但显然不是。 I have a React app hosted on S3. 我在S3上托管了一个React应用。 Obviously, the React app has some variables I would like to not share with everyone. 显然,React应用程序具有一些我不想与所有人共享的变量。 Like the location of the backend. 喜欢后端的位置。 Normally, I would store that information in an environment variable on something like Heroku or Netlify. 通常,我会将这些信息存储在Heroku或Netlify之类的环境变量中。

How to you hide sensitive information for apps on S3? 如何在S3上隐藏应用程序的敏感信息? I've heard something about using Lambda? 我听说过有关使用Lambda的信息吗? Is that the easiest way to do it? 这是最简单的方法吗?

If you need to protect sensitive information you cannot put them inside the static assets in S3 inside react frontend. 如果您需要保护敏感信息,则不能将它们放置在S3前端的静态资产中。

  • But it is still possible to use a different private bucket to store these variables. 但是仍然可以使用其他私有存储区来存储这些变量。
  • Create an API with API Gateway (Optionally Lambda) and store the variables in DynamoDB. 使用API​​网关(可选为Lambda)创建一个API,并将变量存储在DynamoDB中。
  • Directly store in DynamoDB from frontend with DynamoDB finegrained access control . 使用DynamoDB细粒度的访问控制 ,可以从前端直接存储在DynamoDB中。

Either of the above with access control having a login page, using AWS Cognito. 以上两种使用AWS Cognito的访问控制都具有登录页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM