TrackIt
Published in

TrackIt

How to Make AWS Nimble Workstation Persistent

Amazon Nimble Studio is a service for creative studios to produce video, visual effects, animations, and interactive content. The cloud-based studio provides on-demand access to virtual workstations, elastic file storage, render farm capacity, and tools to manage security, permissions, and collaborations.

The Problem

Following a recent update of Nimble Studio, workstations now have a lifecycle which is possible to control through an AWS SDK. However, workstations with a defined lifecycle could be a problem if you want to ensure some data is persistent. The benefits of the lifecycle implementation is that a machine in a Stoppedstate is much quicker to launch later on and retains it’s previous state.

If a Nimble Studio machine is up longer than 11.5 hours in the state Ready or Stopped the machine will then terminate the streaming session.

It is possible to extend the streaming machine time limit. The maximum for the Stoppedstate, for instance, is up to four days as you can see in the image below. If a persistent Stopped state longer than four consecutive days is required a programmatic solution is necessary.

Solution

To solve this problem we must set up a process that will automatically start and stop a workstation before its termination, checking every day. We will detail the steps below so you can implement all the workflow to get the job done.

How to Deploy

  1. First, create a lambda in charge of starting nimble instances called start-nimble-workstation. This is pretty straightforward; we list all the workstations in the Nimble Studio and start them if they return the state Stopped. Concurrently we check if the termination date will happen prior to the next 24 hours. One thing to note, you may have to change the REGION_NAME variable to match which region you set up your Nimble Studio.

2. Create a second lambda, called stop-nimble-workstation, to stop instances in essentially the same manner as the function in charge of starting nimble instances.

Make sure, that the boto3version in both of your lambdas is above 1.19.11, so you have access to the latest API methods of Nimble Studio:

  • list_streaming_session
  • start_streaming_session
  • stop_streaming_session

You can check this article to update a python module in your lambda.

3. Create a state machine that will execute the entire workflow. For that, navigate to the Step functions dashboard in the AWS console. Then click on Create state machine. Check, Write your workflow in code, and paste the code below.

Click on Next, give a name to your state machine, then click on Create state machine.

4. Create a Cron Job. In order to do so navigate to the EventBridge dashboard in the AWS console. On the left panel, click on Rules.
Click on Create rule, and give the rule a name.

On the Define pattern section, check Schedule, then check Cron expression, write 0 4 * * ? * so it will execute every day at 4 AM.

On the Select targets section, look for the Step Functions state machine in the first scrolling menu and, on the second one, pick the state machine name you created before. Click on Create. Check if the rule is enabled.

Conclusion

You have now implemented a full start and stop process to keep your workstations persistent!

About TrackIt

TrackIt is an Amazon Web Services Advanced Consulting Partner specializing in cloud management, consulting, and software development solutions based in Venice, CA.

TrackIt specializes in Modern Software Development, DevOps, Infrastructure-As-Code, Serverless, CI/CD, and Containerization with specialized expertise in Media & Entertainment workflows, High-Performance Computing environments, and data storage.

TrackIt’s forté is cutting-edge software design with deep expertise in containerization, serverless architectures, and innovative pipeline development. The TrackIt team can help you architect, design, build, and deploy customized solutions tailored to your exact requirements.

In addition to providing cloud management, consulting, and modern software development services, TrackIt also provides an open-source AWS cost management tool that allows users to optimize their costs and resources on AWS.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store