Skip to content

Instantly share code, notes, and snippets.

@nivleshc
nivleshc / stepfunctions-sagemaker-state-machine.json
Created Apr 30, 2020
This is the AWS Step Function to automate training, build and deployment of an Amazon SageMaker model
View stepfunctions-sagemaker-state-machine.json
{
"Comment": "An AWS Step Function State Machine to train, build and deploy an Amazon SageMaker model endpoint",
"StartAt": "Create Training Job",
"States": {
"Create Training Job": {
"Type": "Task",
"Resource": "arn:aws:states:::sagemaker:createTrainingJob.sync",
"Parameters": {
"TrainingJobName.$": "$$.Execution.Name",
"ResourceConfig": {
@nivleshc
nivleshc / stepfunctions-state-05.json
Created Apr 30, 2020
This is the fifth state for the AWS Step Function to automate training, build and deployment of an Amazon SageMaker model
View stepfunctions-state-05.json
"Display Error":{
"Type": "Pass",
"Result": "Finished with errors. Please check the individual steps for more information",
"End": true
}
@nivleshc
nivleshc / stepfunctions-state-04.json
Created Apr 30, 2020
This is the fourth state for the AWS Step Function to automate training, build and deployment of an Amazon SageMaker model
View stepfunctions-state-04.json
"Create Endpoint":{
"Type":"Task",
"Resource":"arn:aws:states:::sagemaker:createEndpoint",
"Parameters":{
"EndpointConfigName.$": "$.TrainingJobName",
"EndpointName.$": "$.TrainingJobName"
},
"End": true
},
@nivleshc
nivleshc / stepfunctions-state-03.json
Created Apr 30, 2020
This is the third state for the AWS Step Function to automate training, build and deployment of an Amazon SageMaker model
View stepfunctions-state-03.json
"Create Endpoint Config": {
"Type": "Task",
"Resource": "arn:aws:states:::sagemaker:createEndpointConfig",
"Parameters":{
"EndpointConfigName.$": "$.TrainingJobName",
"ProductionVariants": [
{
"InitialInstanceCount": 1,
"InstanceType": "ml.t2.medium",
"ModelName.$": "$.TrainingJobName",
@nivleshc
nivleshc / stepfunctions-state-02.json
Created Apr 30, 2020
This is the second state for the AWS Step Function to automate training, build and deployment of an Amazon SageMaker model
View stepfunctions-state-02.json
"Create Model": {
"Parameters": {
"PrimaryContainer": {
"Image": "544295431143.dkr.ecr.ap-southeast-2.amazonaws.com/xgboost:1",
"Environment": {},
"ModelDataUrl.$": "$.ModelArtifacts.S3ModelArtifacts"
},
"ExecutionRoleArn": "iam-role-arn",
"ModelName.$": "$.TrainingJobName"
},
@nivleshc
nivleshc / stepfunctions-state-01.json
Created Apr 30, 2020
This is the first state for the AWS Step Function to automate training, build and deployment of an Amazon SageMaker model
View stepfunctions-state-01.json
"States": {
"Create Training Job": {
"Type": "Task",
"Resource": "arn:aws:states:::sagemaker:createTrainingJob.sync",
"Parameters": {
"TrainingJobName.$": "$$.Execution.Name",
"ResourceConfig": {
"InstanceCount": 1,
"InstanceType": "ml.m4.xlarge",
"VolumeSizeInGB": 5
@nivleshc
nivleshc / stepfunctions-header.json
Last active Apr 30, 2020
The beginning of the AWS Step Function to automate training, build and deployment of an Amazon SageMaker model
View stepfunctions-header.json
{
"Comment": "An AWS Step Function State Machine to train, build and deploy an Amazon SageMaker model endpoint",
"StartAt": "Create Training Job",
@nivleshc
nivleshc / stepfunctions-sagemaker-iam-s3-policy.json
Created Apr 30, 2020
An AWS IAM Policy for AWS Step Functions to access the Amazon S3 Bucket that contains the training and validation data. The model artifacts will also be uploaded to the Amazon S3 Bucket
View stepfunctions-sagemaker-iam-s3-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::bucketName"
@nivleshc
nivleshc / lifeinsurancebot-error.html
Created Apr 8, 2020
This is the page that will be displayed when there is an error
View lifeinsurancebot-error.html
<html>
<head>
<title>There was an error</title>
</head>
<body>
There was an error. Please check back later or contact the webmaster
</body>
</html>
@nivleshc
nivleshc / lifeinsurancebot-index-modifications.html
Created Apr 8, 2020
This file contains modifications that must be done to the lifeinsurancebot.html file
View lifeinsurancebot-index-modifications.html
// Initialize the Amazon Cognito credentials provider
AWS.config.region = 'us-east-1'; // Region
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
// Provide your Pool Id here
IdentityPoolId: 'us-east-1:XXXXX',
});
var lexruntime = new AWS.LexRuntime();
var lexUserId = 'chatbot-demo' + Date.now();
var sessionAttributes = {};
You can’t perform that action at this time.