2

There appear to be a couple of different ways to pass data to an Windows server instance at launch. It appears amazon has support for now passing commands to the instance at launch as outlined in this post: https://forums.aws.amazon.com/message.jspa?messageID=342135#342135

The .NET code I am using to start the instance is created from within an Amazon AWS console project in Visual Studio 2010

RunInstancesResponse InstanceResponse =  
amazonEC2Client.RunInstances(new RunInstancesRequest()

.WithImageId("ami-9c9f3af5")
.WithInstanceType("t1.micro")
.WithKeyName("yahoo data instance")
.WithMinCount(1)
.WithMaxCount(1)
.WithUserData(Convert.ToBase64String(Encoding.UTF8.GetBytes
(<script>powershell 
Set-ExecutionPolicy Restricted</script>"))));

It seems that nothing I put between the script tags will run. Would appreciate if anyone had any ideas about this or tried to use it. Thanks

1 Answer 1

1

It appears this was just added to the Windows series of AWS AMI's on 10-May-2012. Try again?

Source: "What's New > 2012.05.10", https://aws.amazon.com/amis/microsoft-windows-server-2008-r2-with-sql-server-standard-2008-r2

Sign up to request clarification or add additional context in comments.

1 Comment

They added support for script tags in April, with that release you could then use <powershell></powershell> tags. The issue was that when you launch an ami the EC2-Config service will run once and then set itself to disabled. To create an ami you have to go into the configuration XML file and reset it to enabled and then create your ami from this. The problem was I wasn't realizing it was setting itself to disabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.