This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deploy in the eu-west-1 region | |
serverless deploy --region eu-west-1 | |
# Deploy in the eu-central-1 region | |
serverless deploy --region eu-central-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(I am using the httpie https://httpie.org/ commandline tool) | |
http https://<YOUR API>.execute-api.eu-central-1.amazonaws.com/dev/get/foobar ✔ 14:49:30 | |
HTTP/1.1 200 OK | |
Connection: keep-alive | |
Content-Length: 112 | |
Content-Type: application/json | |
Date: Tue, 24 Apr 2018 12:01:50 GMT | |
X-Amzn-Trace-Id: sampled=0;root=1-5adf1cae-c2edf25c6a7545c3e172478f | |
x-amz-apigw-id: F2FrSHB0liAFo4Q= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http POST https://<YOUR API>.execute-api.eu-west-1.amazonaws.com/dev/create "item_id"="barfoo" | |
HTTP/1.1 200 OK | |
Connection: keep-alive | |
Content-Length: 22 | |
Content-Type: application/json | |
Date: Tue, 24 Apr 2018 12:04:38 GMT | |
X-Amzn-Trace-Id: sampled=0;root=1-5adf1d55-50b949696dfd3547bb7f9f28 | |
x-amz-apigw-id: F2GFbE1WDoEFuGA= | |
x-amzn-RequestId: a94e2c6f-47b7-11e8-8354-892b5fef891a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http https://globe.adhorn.me/get/foobar | |
HTTP/1.1 200 OK | |
Connection: keep-alive | |
Content-Length: 112 | |
Content-Type: application/json | |
Date: Tue, 24 Apr 2018 14:26:10 GMT | |
X-Amzn-Trace-Id: sampled=0;root=1-5adf3e82-30d3c630cf5b16ebbdceaf04 | |
x-amz-apigw-id: F2a0YEk6FiAFWUw= | |
x-amzn-RequestId: 6f3a6121-47cb-11e8-8f1d-618431149814 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in {1..10} | |
do http POST https://globe.adhorn.me/create "item_id"="boo$i" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create VPC in region us-east-1 | |
aws ec2 create-vpc --cidr-block 10.0.0.0/16 --region us-east-1 | |
{ | |
"Vpc": { | |
"CidrBlock": "10.0.0.0/16", | |
"DhcpOptionsId": "dopt-f14eca94", | |
"State": "pending", | |
"VpcId": "vpc-xxxxxx", | |
"InstanceTenancy": "default", | |
"Ipv6CidrBlockAssociationSet": [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create VPC in region us-east-1 | |
aws ec2 create-vpc --cidr-block 10.0.0.0/16 --region us-east-1 | |
{ | |
"Vpc": { | |
"CidrBlock": "10.0.0.0/16", | |
"DhcpOptionsId": "dopt-f14eca94", | |
"State": "pending", | |
"VpcId": "vpc-xxxxxx", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create subnet associated with the VPC | |
aws ec2 create-subnet --vpc-id vpc-xxxxxx --cidr-block 10.0.1.0/24 --region us-east-1 | |
{ | |
"Subnet": { | |
"AvailabilityZone": "us-east-1b", | |
"AvailableIpAddressCount": 251, | |
"CidrBlock": "10.0.1.0/24", | |
"DefaultForAz": false, | |
"MapPublicIpOnLaunch": false, | |
"State": "pending", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the routing info from the VPC. | |
aws ec2 describe-route-tables --filters "Name=vpc-id,Values=vpc-xxxxxxx" --region us-east-1 | |
{ | |
"RouteTables": [ | |
{ | |
"Associations": [ | |
{ | |
"Main": true, | |
"RouteTableAssociationId": "rtbassoc-4112743e", | |
"RouteTableId": "rtb-xxxxxx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create the initial table with stream enabled in us-east-1 | |
aws dynamodb create-table \ | |
--table-name MyGlobalTable \ | |
--attribute-definitions \ | |
AttributeName=item_id,AttributeType=S \ | |
--key-schema \ | |
AttributeName=item_id,KeyType=HASH \ | |
--provisioned-throughput \ | |
ReadCapacityUnits=5,WriteCapacityUnits=5 \ | |
--stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \ |