Skip to content

Instantly share code, notes, and snippets.

View neilkuan's full-sized avatar
🎯
Focusing

Neil Kuan neilkuan

🎯
Focusing
View GitHub Profile
exports.handler = (event, context, callback) => {
// Extract the request from the CloudFront event that is sent to Lambda@Edge
var request = event.Records[0].cf.request;
var newuri = ''
// Extract the URI from the request
var olduri = request.uri;
if (olduri == '/'){
newuri = olduri+ 'index.html';
}else{
$ curl -LO https://eksworkshop.com/beginner/110_irsa/deploy.files/iam-pod.yaml
--- inside
apiVersion: apps/v1
kind: Deployment
metadata:
name: eks-iam-test
spec:
replicas: 1
selector:
matchLabels:
# need awscli >= 1.16.x , docker
# aws ecr get-login --registry-ids < ecr-account-id > --region < region-you-want > --no-include-email
#way 1.
# Get docker registry token from A account ECR
[ec2-user@192-168-0-99 ~ ] aws ecr get-login --registry-ids 1333333333 --region ap-northeast-1 --no-include-email
#--output
docker login -u AWS -p eyJwYXlsb2FkIjoi....NUZCeTkydVU2b2R9 https://1333333333.dkr.ecr.us-east-1.amazonaws.com
# Copy output for Login A account ECR
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "CrossAccountPull",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::1333333333:root"
},
@neilkuan
neilkuan / cdk_stack.py
Created April 4, 2020 08:13
cdk_stack.py
##from aws_cdk import core
#import modlue you needed
import os.path as path
import sys
from aws_cdk import (
core,
aws_ec2 as ec2,