Sleep function in AWS CloudFormation

IMHO one of the most important missing pieces in CloudFormation is not having the ability to explicitly specify a SLEEP or WAIT function. It is not that it is totally impossible to the implement the same, except that, it would involve having a hard work around one of which is to inject the wait script via the user data with WaitHandle and WaitConditions on EC2 instances.

A sample implementation of wait using EC2 Instance’s WaitHandle

There is absolutely no downside to the approach and also it is easier to bake the wait script inside the CloudFormation template; the problem would arise if you wanted to have the same WAIT functionality to be implemented for the stacks which do not have EC2 instances as part of the stack.

I tried and succeeded using Amazon Lambda for the purpose instead of EC2. To summarize the implementation; a CloudFormation custom resource would call a lambda function and all that the function would do is to respond after 5 minutes [current maximum execution time for lambda function execution time]. Again, if you need to wait longer than 5 minutes, you would use the DependsOn in CloudFormation and cascade the Custom Resource Calling.

Wait Function – AWS Lambda

Below is the sample Code where you create a VPC and a Security Group after waiting a 5 minute delay time and 10 minute delay.




[Solved] Amazon Workspaces Registration Service Failure

If you encounter an error indicating cannot connect to Amazon Workspaces’ Registration Services; well actually it has nothing to do with the network or connectivity issues. The error info is actually misleading.

Workspaces Unable to Connect Registration Service

Getting to the end of the topic to know about the fix; is to key in the new WORKSPACE REGISTRATION CODE. That can be found from the Amazon Management Console where the new Workspace was provisioned.


Once you grab the registration code; you can change it from the Workspace Application Options.

Manage Registrations


Once a proper registration code is specified; you are good to go if see all the checks passed.


After you complete your credentials configuration provided to you via. the email. You should be able to login to your newly launched Workspace Instance.