Following the steps online access your AWS account through AWS Event Engine:
https://sagemaker-immersionday.workshop.aws/en/prerequisites/option1.html
#!/usr/bin/env python3 | |
""" | |
The following script demonstrates how to use the AWS Boto3 SDK to iterate through | |
all of the users in an AWS Cognito User Pool and examine the events associated | |
with each user. | |
If any failed authentication events are found the script formats them as messages | |
and logs them to CloudWatch logs. | |
This script could easily be modified to run periodically as a Lambda function |
#!/usr/bin/bash | |
# This script is built to compile Qt5 on an Amazon Linux2-based Amazon Workspace | |
# This script is known to fail on a Standard Workspace with 2 vCPU and 4 GB of RAM (Out of Memory error suspected) | |
# Script has been tested on a Power Workspace with 4 vCPU and 32 GB of RAM | |
# based upon documentation at | |
# https://doc.qt.io/qt-5/linux-requirements.html | |
set -e |
import os | |
import boto3 | |
lclient = boto3.client ('lambda') | |
print ('function loaded') | |
def lambda_handler(event, context): | |
lclient.delete_function (FunctionName = context.function_name) | |
print ('I am deleted') | |
return True |
/** The following is a NodeJS port of the AWS SigV4 signing sample code (Python) to NodeJS | |
* The addition of the Authorization header has been informed by the use of Postman | |
* For more information see the following documentation: | |
* http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html | |
*/ | |
var https = require('https'); | |
var crypto = require('crypto'); | |
function sign(key, message) { |
Following the steps online access your AWS account through AWS Event Engine:
https://sagemaker-immersionday.workshop.aws/en/prerequisites/option1.html
#!/usr/bin/env bash | |
############################################################################################### | |
# | |
# The following shell script uses the AWS CLI to forcefully detach a non-root volume from a | |
# running EC2 instance. In preliminary testing this produced a read-only filesystem on a | |
# running host with the volume mounted. This is intended to grossly simulate communication | |
# errors with the EBS volume from an EC2 instance. | |
# | |
# Note that this script will NOT detach the root volume from an EC2 instance. |
#!/bin/bash | |
# The following shell script uses Amazon Athena to query AWS CloudTrail logs for any occurrences of the | |
# action sagemaker:ListNotebookInstances. The query returns the user identity who invoked the API, along | |
# with the region where the API was called. A simple count of the number of invokes is outputted as a | |
# result. | |
SQL="SELECT useridentity.arn, eventname, eventsource, awsregion, sourceipaddress, errorcode, eventtime FROM cloudtrail_logs_account_logging WHERE eventsource = 'sagemaker.amazonaws.com' AND eventname in ('ListNotebookInstances') AND eventtime > '2020-04-15' LIMIT 3;" | |
EXEC_ID=$(aws athena start-query-execution --query-string "$SQL" --result-configuration OutputLocation=s3://my-s3-logging-bucket/queries --query 'QueryExecutionId' --output text) |
[ | |
{ | |
"Entry": "/public/research", | |
"Target": "/maxld-public-bucket" | |
}, | |
{ | |
"Entry": "/subscribed/2018/indices", | |
"Target": "/maxld-subscribe-bucket/historical/2018/indices" | |
}, | |
{ |
#!/bin/bash | |
set -e | |
AWS_REGION=eu-west-1 | |
aws rds describe-db-instance-automated-backups --region $AWS_REGION --query 'DBInstanceAutomatedBackups[*].{DatabaseID:DBInstanceIdentifier,Earliest:RestoreWindow.EarliestTime,Latest:RestoreWindow.LatestTime}' --output table |
#!/bin/bash | |
set -e | |
AWS_REGION=eu-west-2 | |
SOURCE_DATABASE_NAME=database-1 | |
RESTORE_TIME='2020-10-28T22:02:01+00:00' | |
NEW_DATABASE_NAME="rds-db-$RANDOM" |