AWS Lambda: Advanced Coding Session (slides)
Live demos:
- Amazon API Gateway Access Control
- Amazon Kinesis Streams processing
- Amazon Cognito Sync trigger
- AWS CloudFormation Custom Resources
Live demos:
sudo curl -o /usr/local/bin/imgcat -O https://raw.githubusercontent.com/gnachman/iTerm2/master/tests/imgcat && sudo chmod +x /usr/local/bin/imgcat | |
# If you have a better way to fix the permissions, comment below! |
## 'say' command is needed. (only Mac OS available) | |
students = ['뽀로로','포비','크롱','루피','페티'] | |
def lotto(students): | |
import random,os | |
random.shuffle(students) | |
try: | |
msg = students[0] + '님, 축하드립니다!' | |
print (msg) |
# public ip for ap-northeast-1 / EC2 | |
curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | if .service == "EC2" then . else empty end' | jq -r '. | if .region == "ap-northeast-1" then .ip_prefix else empty end' | |
{ | |
"Version": "2012-10-17", | |
"Id": "Policy1484600284333", | |
"Statement": [ | |
{ | |
"Sid": "Stmt1484600282259", | |
"Effect": "Deny", | |
"Principal": "*", | |
"Action": [ | |
"s3:PutObject", |
from troposphere import Ref, Template | |
import troposphere.ec2 as ec2 | |
t = Template() | |
instance = ec2.Instance("myinstance") | |
instance.ImageId = "ami-951945d0" | |
instance.InstanceType = "t1.micro" | |
t.add_resource(instance) |
import boto3 | |
keyId = '<Key ARN>' | |
text = 'Hello Cloud!' | |
kms = boto3.client('kms', region_name='ap-northeast-1') | |
enc = kms.encrypt(KeyId = keyId, Plaintext = text)['CiphertextBlob'] | |
print (enc) | |
dec = kms.decrypt(CiphertextBlob = enc)['Plaintext'] |
aws configure set default.s3.signature_version s3v4 | |
aws s3 presign s3://<bucket name>/<file name> --expires-in 30 |
aws cloudwatch put-metric-data --namespace "MyService" --metric-name "UserCount" --value 2000 |
import boto3 | |
client = boto3.client('sns', region_name='ap-northeast-1') | |
msg = 'Hello World' | |
number = '+821011112222' | |
client.publish(PhoneNumber=number, Message=msg) |