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
{ | |
"dynamic": { | |
"instance-identity": { | |
"document": { | |
"accountId": "012345678901", | |
"architecture": "x86_64", | |
"availabilityZone": "us-east-2b", | |
"billingProducts": null, | |
"devpayProductCodes": null, | |
"imageId": "ami-002068ed284fb165b", |
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
Number of vCPU | Number of vNICs | |
---|---|---|
2 or less | 2 | |
2 to 8 | 2 to 8 | |
8 or more | 8 |
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
Instance type | Maximum network interfaces | |
---|---|---|
t3.nano | 2 | |
t3.small | 3 | |
t3.xlarge | 4 | |
m5.4xlarge | 8 | |
m5.16xlarge | 15 | |
p4d.24xlarge | 4x15 |
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
Instance type | Private IPv4 addresses per interface | |
---|---|---|
t3.nano | 2 | |
t3.small | 4 | |
t3.medium | 6 | |
m5.large | 10 | |
t4g.large | 12 | |
c4.xlarge | 15 | |
d3.8xlarge | 20 | |
c5.4xlarge | 30 | |
c5.metal | 50 |
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
{ | |
"Id": "only-cloudwatch-logs", | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "Enable IAM User Permissions", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "arn:aws:iam::123456789012:root" | |
}, |
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
import json | |
import boto3 | |
import time | |
def lambda_handler(event, context): | |
LOG_GROUP='awesome-logs' | |
LOG_STREAM='test' | |
logs = boto3.client('logs') | |
logs.create_log_stream(logGroupName=LOG_GROUP, logStreamName=LOG_STREAM) |
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
AWSTemplateFormatVersion: 2010-09-09 | |
Parameters: | |
SnsTopicArn: | |
Type: String | |
Default: '' | |
Description: >- | |
A pre-existing SNS topic to send S3 notifications to. | |
If not provided, a new topic will be created. | |
MyEmail: | |
Type: String |
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
# Loop through all EC2 instances (except spot and terminated) and enable termination protection | |
for I in $(aws ec2 describe-instances --query 'Reservations[*].Instances[?(InstanceLifecycle!=`spot` && InstanceState!=terminated)].[InstanceId]' --output text); do aws ec2 modify-instance-attribute --disable-api-termination --instance-id $I; done | |
# Loop through all EC2 instances (except spot and terminated) and disable termination protection | |
for I in $(aws ec2 describe-instances --query 'Reservations[*].Instances[?(InstanceLifecycle!=`spot` && InstanceState!=terminated)].[InstanceId]' --output text); | |
do aws ec2 modify-instance-attribute --no-disable-api-termination --instance-id $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
# Just a note to remember how I looped through rows in an ndjson from S3 | |
from botocore.vendored import requests | |
import json | |
import boto3 | |
from io import StringIO | |
s3 = boto3.resource('s3') | |
my_bucket = s3.Bucket(bucket) | |
obj = s3.Object(bucket, key) |
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
- Remove All Comments (with command palette) | |
- Control-J (on Mac) |