Replace bastion hosts with AWS Session Manager https://reinvent2019.aws-management.tools/mgt406/en/
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 | |
Description: Amazon EKS - Node Group | |
Parameters: | |
KeyName: | |
Description: The EC2 Key Pair to allow SSH access to the instances | |
Type: 'AWS::EC2::KeyPair::KeyName' | |
NodeImageId: | |
Description: AMI id for the node instances. | |
Type: 'AWS::EC2::Image::Id' | |
NodeInstanceType: |
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 | |
set -e | |
sudo -u ec2-user -i <<'EOP' | |
## INSTALL THEIA IDE FROM SOURCE | |
EC2_HOME=/home/ec2-user | |
mkdir ${EC2_HOME}/theia && cd ${EC2_HOME}/theia | |
### begin by installing NVM, NodeJS v10, and Yarn | |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash |
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 | |
# | |
# This script takes about 5 minutes to run and will delay the availability of | |
# your SageMaker notebook. | |
# v1.3, release 05may2020 | |
# | |
# THIS SCRIPT INSTALLS: | |
# - THEIA IDE w/ Jupyter Server proxy | |
# - UPGRADES JUPYTERLAB | |
# - INSTALL VOILA (https://github.com/voila-dashboards/voila) |
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 | |
### | |
# | |
# The following script queries AWS CloudTrail for any events matching $USERNAME which occurred with the permissions | |
# associated with $ROLE_ARN. All events that have occcurred as of $START_TIME (Unix timestamp in seconds) will | |
# be retrieved and the IAM actions of those events printed to STDOUT in a sorted and de-duplicated list. | |
# | |
# Sample Output: | |
# |
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
""" | |
This script is a simple FashionMNIST training script which uses MXNet's. | |
It has been orchestrated with SageMaker Debugger hook to allow saving tensors during training. | |
Here, the hook has been created using its constructor to allow running this locally for your experimentation. | |
When you want to run this script in SageMaker, it is recommended to create the hook from json file. | |
Please see scripts in either /examples/tensorflow/sagemaker_byoc or /examples/tensorflow/sagemaker_official_container | |
folder based on your use case. | |
""" | |
# Standard Library | |
import argparse |
- Visit https://github.com/awslabs/amazon-sagemaker-examples, at the bottom of the page you will find a link to create an Amazon SageMaker notebook
- Follow the instructions using an
ml.m5.2xlarge
instance type. - When the notebook has been created click
Open JupyterLab
.
Clone the Amazon SageMaker Examples to your notebook from GitHub.
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 | |
# 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) |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Deny", | |
"Action": "ec2:RunInstances", | |
"Resource": "*" | |
} | |
] |
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 | |
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" |