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
STREAM_NAME=wildrydes | |
SHARD_ID=ShardId-000000000000 | |
aws kinesis get-records --shard-iterator $( \ | |
aws kinesis get-shard-iterator \ | |
--stream-name ${STREAM_NAME} \ | |
--shard-id ${SHARD_ID} \ | |
--shard-iterator-type TRIM_HORIZON \ | |
--output text \ | |
) --output text --query 'Records[*].[Data]' | while read line ; do echo $line | base64 --decode ; echo ; 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
# Ubuntu ONLY! Amazon Linux instructions here: | |
# (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html#install_docker) | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sh get-docker.sh | |
sudo usermod -a -G docker ubuntu | |
sudo reboot |
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
aws cloudwatch get-metric-statistics \ | |
--namespace AWS/EC2 \ | |
--metric-name CPUUtilization \ | |
--statistics Maximum \ | |
--start-time 2019-01-01T00:00:00Z \ | |
--end-time 2020-01-01T00:00:00Z \ | |
--period $((60*60*24)) \ | |
--query 'sort_by(Datapoints,&Timestamp)[*]' |
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
# https://adamj.eu/tech/2019/08/19/cloudformation-minimum-viable-template/ | |
AWSTemplateFormatVersion: 2010-09-09 | |
Resources: | |
Topic: | |
Type: AWS::SNS::Topic |
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
#!/bin/bash | |
# https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html | |
sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm | |
# this to check | |
sudo systemctl status amazon-ssm-agent |
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
# inspired by https://jameshfisher.com/2018/12/31/how-to-make-a-webserver-with-netcat-nc/ | |
#!/bin/bash | |
yum install -y socat | |
socat TCP4-LISTEN:${PORT:-80},fork SYSTEM:' \ | |
read -r line \ | |
read -r _ workload _ <<< "$line" \ | |
workload=${workload:1} | |
[ ! -z "$workload" ] && timeout $workload yes > /dev/null \ | |
echo HTTP/1.0 200 \ | |
echo Content-Type\: text/plain \ |
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
#!/bin/bash | |
yum install -y socat | |
socat TCP4-LISTEN:80,fork SYSTEM:' \ | |
echo HTTP/1.0 200 \ | |
echo \ | |
echo Response from $(hostname) at $(date '+%s.%N')' |
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
#!/bin/bash | |
yum update -y | |
yum install -y nfs-utils | |
FILE_SYSTEM_ID=fs-xxxxxxxx | |
AVAILABILITY_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone ) | |
REGION=${AVAILABILITY_ZONE:0:-1} | |
MOUNT_POINT=/mnt/efs | |
mkdir -p ${MOUNT_POINT} | |
chown ec2-user:ec2-user ${MOUNT_POINT} | |
echo ${FILE_SYSTEM_ID}.efs.${REGION}.amazonaws.com:/ ${MOUNT_POINT} nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,_netdev 0 0 >> /etc/fstab |
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
function Button() { | |
const [counter, setCounter] = useState(0); | |
return <button onClick={() => setCounter(counter+1)}>{counter}</button>; | |
} | |
ReactDOM.render( | |
<Button />, | |
document.getElementById('mountNode'), | |
); |