... At an AWS event

If you are at an AWS event, an AWS account was created for you to use throughout the workshop. You will need the Participant Hash provided to you by the event’s organizers.

  1. Connect to the portal by browsing to https://dashboard.eventengine.run/.
  2. Enter the Hash in the text box, and click Proceed
  3. In the User Dashboard screen, click AWS Console
  4. In the popup page, click Open Console

You are now logged in to the AWS console in an account that was created for you, and will be available only throughout the workshop run time. A CloudFormation stack has been automatically deployed for you with the following resources:

  • A VPC
  • An S3 bucket
  • An ECR repository
  • A Launch Template
  • An AWS Step Functions state machine
  • An instance profile for AWS Batch compute environment
  • The Cloud9 environment where you will run all the commands
  • An AWS IAM Role used by AWS Fault Injection Simulator

You can check the CloudFormation stack by downloading the following file: CloudFormation stack

Reviewing the Launch Template

You can check the CloudFormation stack by downloading the following file: CloudFormation stack

Note that the UserData of the created Launch Template contains the following script:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="

--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"

#!/bin/bash
echo "ECS_CLUSTER=EcsSpotWorkshop" >> /etc/ecs/ecs.config
echo "ECS_ENABLE_SPOT_INSTANCE_DRAINING=true" >> /etc/ecs/ecs.config
echo "ECS_CONTAINER_STOP_TIMEOUT=90s" >> /etc/ecs/ecs.config
echo "ECS_ENABLE_CONTAINER_METADATA=true" >> /etc/ecs/ecs.config

--==MYBOUNDARY==--

What we are doing here is enabling Spot Instance Draining. When ECS Spot Instance draining is enabled on the instance, ECS receives the Spot Instance interruption notice and places the instance in DRAINING status. When a container instance is set to DRAINING, Amazon ECS prevents new tasks from being scheduled for placement on the container instance. To learn more about Spot instance interruption notices, visit Spot Instance interruption notices.

Gathering the CloudFormation outputs

You will create other AWS resources using the AWS CLI in Cloud9, a cloud-based integrated development environment (IDE) that lets you write, run, and debug your code with just a browser. It includes a code editor, debugger, and terminal. Cloud9 comes prepackaged with essential tools for popular programming languages, including JavaScript, Python, PHP, and more.

Navigate to the Cloud9 console and open the environment that was created for you. Execute the following commands to retrieve the outputs of the CloudFormation stack:

export AWS_DEFAULT_REGION=$(curl -s  169.254.169.254/latest/dynamic/instance-identity/document | jq -r '.region')
export STACK_NAME="RenderingWithBatch"

for output in $(aws cloudformation describe-stacks --stack-name ${STACK_NAME} --query 'Stacks[].Outputs[].OutputKey' --output text)
do
    export $output=$(aws cloudformation describe-stacks --stack-name ${STACK_NAME} --query 'Stacks[].Outputs[?OutputKey==`'$output'`].OutputValue' --output text)
    eval "echo $output : \"\$$output\""
done

You can now start the workshop by heading to Rendering pipeline.