Skip to content

Instantly share code, notes, and snippets.

View jkielbaey's full-sized avatar

Johan Kielbaey jkielbaey

View GitHub Profile
Description CIDR
AWS environment 10.0.0.0/16
Shared VPC 10.0.0.0/22
Team A VPC 10.0.4/0/22
Team B VPC 10.0.8.0/22
Team C VPC 10.0.12.0/22
Team D VPC 10.0.16/0/22
On-premise IP range 172.16.0.0/16
import boto3
table_name = ‘sample_table’
ssm = boto3.client('ssm')
table = boto3.resource('dynamodb').Table(table_name)
# Store current read and write capacity units.
ssm.put_parameter(
Name=’/dynamodb/{}/read_capacity_units’.format(table_name),
Value=str(table.provisioned_throughput[‘ReadCapacityUnits’]),
import boto3
client = boto3.client('rds')
db_instance_id = ‘id’
# To stop a DB instance.
response = client.stop_db_instance(
DBInstanceIdentifier=db_instance_id
)
import boto3
ecs = boto3.client('ecs')
ssm = boto3.client('ssm')
cluster_name = “sample-cluster”
service_name = “sample-service”
# To stop the tasks
response = ecs.describe_services(
cluster=cluster_name,
import boto3
instance = boto3.resource('ec2').Instance('id')
# To stop the instance
instance.stop()
# To start the instance
instance.start()