Skip to content

Instantly share code, notes, and snippets.

@techministrator
techministrator / asyns-await.js
Last active September 28, 2021 06:16
temporary
'use strict'
var AWS = require('aws-sdk')
var ssm = new AWS.SSM({region: 'us-east-1'})
const getParameter = async (params) => {
try {
let resp = await ssm.getParameter(params).promise()
console.log(resp.Parameter.Value)
return resp.Parameter.Value
@techministrator
techministrator / lambda_edge_basic_auth_with_ssm.js
Created September 11, 2021 08:53
Authenticate CloudFront Viewer Request with Lambda@Edge Basic Auth with User/Pass stored in SSM Parameter Store
'use strict'
var AWS = require('aws-sdk')
var ssm = new AWS.SSM({region: 'us-east-1'})
const getParameter = async (params) => {
try {
const resp = await ssm.getParameter(params).promise()
console.log(resp.Parameter.Value)
return resp.Parameter.Value
@techministrator
techministrator / spa_with_s3_private_and_cloudfront.tf
Last active August 28, 2021 18:37
Terraform creates Single Page App using Private S3 Bucket and CloudFront with Custom Domain Name
# This simple file presents how to provision a HTTPS Custom Domain Single Page App (like React)
# using S3 Private Bucket (not configured as Website) and CloudFront. Following best practice,
# users can only access S3 content # via Custom Domain Name or CloudFront endpoint. Not directly to S3 bucket.
provider "aws" {
region = "ap-southeast-1"
}
## Data
data "aws_region" "current" {}