Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring environment variables for static web site on AWS S3 [closed]

Tags:

amazon-s3

I am trying to setup a simple static Angular website on S3 per the info: http://docs.aws.amazon.com/gettingstarted/latest/swh/website-hosting-intro.html

I want to send email via a form that needs to send sendgrid api keys. Obviously, I want to use environment variables for this to avoid having keys in code. How do you setup environment variables in S3?

I looked into aws-cli tool but it only shows examples of what appear to be AWS specific enviroment variables. Is there somewhere in AWS/S3 console were these can be set?

BTW- I would like to use this Angular service which demonstrates the sendgrid service: https://github.com/onaclovtech/sendgrid/blob/master/sendgrid.js

like image 820
Sean Kelley Avatar asked Mar 25 '16 19:03

Sean Kelley


People also ask

Can static websites created with Amazon S3 be interactive?

You can use Amazon S3 to host a static website. On a static website, individual webpages include static content. They might also contain client-side scripts. By contrast, a dynamic website relies on server-side processing, including server-side scripts, such as PHP, JSP, or ASP.NET.


1 Answers

You can't set environment variables in S3. S3 is just a static object store, not a dynamic content server. To evaluate variable values would be the very definition of dynamic content, and S3 only serves static content.

Note that AngularJS code runs in the browser, not on a server, so those keys you want to keep out of your code are going to be viewable in the browser by anyone that knows how to look. There's no way for you to hide those values if you want to call SendGrid from a client-side framework.

like image 104
Mark B Avatar answered Oct 07 '22 10:10

Mark B