Easy AWS S3 IP Whitelisting

Working on a website hosted in AWS S3, but don’t want to give public access yet? Easy fix.

First navigate to your console and go to S3 service.

Next, navigate to the bucket where your static site is hosted and go to Permissions tab, then click on bucket policy.

to

In a new browser tab, navigate to https://www.whatismyip.com/    to perform an IP address lookup.

After knowing the IP address, enter the following JSON policy into the policy editor. You will need to modify the two items in bold that correspond to your bucket name and IP address.


GeSHi Error: GeSHi could not find the language json (using path /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/codecolorer/lib/geshi/) (code 2)

Click save, and then your index.html document will be accessible form the machine you are on.

Setting Dynamic Date & Time in Postman

If you are a developer or technologist like me, chances are you are very familiar with Postman for working with RESTful APIs. Depending on what types of APIs or services you work with, there are many use cases or instances when a date / time will be required in a given request. Lucky for us, the folks at Postman have made pre-request scripts available which cna be utilized in a number of different ways to dynamically set variables before a given request is executed.

In this post, we are going to look at how you can dynamically set an ISO formatted date time to the current time without having to manually set the value.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var today = new Date();
var dd = today.getDate();
var dd_end = today.getDate()+2; //two days ahead for end date
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
var hh = today.getHours();
var ss = today.getSeconds();
if(dd<10) {
dd = '0'+dd
}
if(dd_end<10) {
dd_end = '0'+ dd_end
}
if(mm<10) {
mm = '0'+mm
}
if(hh<10) {
hh = '0'+hh
}
if(ss<10) {
ss = '0'+ss
}
today = yyyy +'-'+ mm +'-'+ dd + 'T' + hh + ':' + ss + 'Z';
postman.setEnvironmentVariable("date", today);
enddate = yyyy +'-'+ mm +'-'+ dd_end + 'T' + hh + ':' + ss + 'Z';
postman.setEnvironmentVariable("enddate", enddate);