Starting/Stopping single instance with CLI - coldfusion

I wonder how to start/stop a ColdFusion 10 instance from terminal. If I restart the CF Server, it automatically starts the cfusion instance; other instances need to be started with CFIDE/administrator -> Enterprise Manager -> Instance Manager -> click on play-icon:
How could I start my instance named "standardwebs" from command line?

Take a look in {instance-dir}/bin and you should find a startup script for that instance.

Related

How to run .exe file on startup on gcp windows instance

I am having a VM, windows instance (GCE) on google cloud platform. I want to run a program(.exe) every time at the start of the instance.
I am able to run the file by putting it in the startup folder. but I want to run it using startup script as suggested by google here: running startup scripts on a google compute engine
To run .exe on GCP when Windows VM instance start/restart.
Click edit on VM instance
Expand Management, security, disks, networking, sole tenancy section
In the Metadata section, provide windows-startup-script-cmd as the metadata key.
In the Value box, provide /path/to/exe-file

How to run a boot script on windows EC2?

My question is how do you run a boot script on a windows EC2 (similar to this question but for windows rather than linux)
Also, does a 'stopped' instance being restarted count as a 'boot', or must the instance be terminated in order for the script to run. I ask because I would like the script to run whenever a lambda starts a stopped (not terminated) instance
A script can be passed in the User Data property.
If you are using a Windows AMI, and the first line of the script begins with <powershell> or <script> (for normal DOS commands), then the script will be executed the first time that the instance is started.
For details, see: Running Commands on Your Windows Instance at Launch - Amazon Elastic Compute Cloud
Such a script only runs the first time the instance is started. More accurately, it is only once per Instance ID. This means that if you make an AMI of the instance, then any new instances launched from the AMI will run the User Data script.
If you wish a script to run whenever the virtual machine is turned on, then use the capabilities of the operating system. It has nothing to do with the fact that it is an Amazon EC2 instance.

Always enable 'Execute UserData after next service start' for AWS EC2 instance

I have a server that starts and stops on a daily basis. We take AMIs of this server regularly. I want the AMIs to execute UserData on service start, but unless I remember to enable this option manually in 'Ec2 Service Properties' then any servers created from the AMI will not run the UserData script.
How can I set this flag so that it is always enabled?
There is a config file at C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml. You can enable it there when you create the AMI.

How do I update new instances started by AWS auto scaling?

We use AWS cloudformation service to initialize our stack, and set up the auto scaling service to bring up new app servers when load is rising.
My understanding is that Auto Scaling can only start predefined AMI as new instances. These instances could be different from other running instances, because we may have updated packages/source code deployed on those instances.
How can I bring the new instances up-to-date?
Should I update the AMIs everytime I deploy something new to the running instances? Or is there anyway to trigger auto-deployment on new instances (Opsworks) when auto scaling?
I am new to AWS, so pardon me if my question is rudimentary.
There are multiple ways of doing this. My preferred approach is never to touch the servers directly, but instead create a new AMI whenever I deploy a new version of the software.
To do this, use the AutoScalingRollingUpdate property for the auto-scaling group. When you then change ImageId for the launch configuration, AWS will automatically replace your old servers with new ones as a rolling upgrade.
I have a simple deploy script that creates a new AMI, replaces ImageId in the template, and then does a stack update - AWS takes care of the rest.
When creating EC2 instances from Beanstalk, it automatically creates a AutoScaling Group and Launch Configuration based on the specified environment selections. Creating the instance from base AMI is done using a custom code call user data which includes the shell script to create folders and install relevant software.
You can add a new shell scripts or commands there to do your custom work before starting a new instance. This way it is much simpler. e.g. you can run yum update before starting a instance
To find user data section
Go to EC2 Console -> Go to launch configurations section (on left) -> Select the correct launch configuration and copy it -> Click view user data -> Add your scripts and commands as required -> Modify the relevant Auto Scaling group to point to the new launch configuration

how to add user data in amazon Launch Configuration

I have a AMI which is used to launch instances automatically though Amazon Launch configuration.
The issue I am facing is that after instance gets launched I need to run some command which should start the WebServer automatically. how can I do that using user data option from launch configuration.
You can find the option "User Data" under "Advanced Details" section in the Launch Configuration Wizard
I don't think there is anyway via the AWS console or with the official aws-tools to modify a Launch Configuration. I believe you have to create a new one with the user data and associate it with the autoscaling group or groups it's in with these two scripts:
as-create-launch-config
as-update-auto-scaling-group
However, if you're brave...
I did find this: https://github.com/colinbjohnson/aws-missing-tools/tree/master/as-update-launch-config
It explicitly limits the type of instance you're using (it was wrote in 2012) to a narrow list of older options, so update it to new ones.
Outside this, I've not tested the script, so good luck!
From the documentation:
Follow the procedure for launching an instance at Launching Your Instance from an AMI, but when you get to Step 6, paste the user data script text into the User data field and then complete the launch procedure.
If you don't want to copy-paste a script every time you launch an instance, you have a few different options:
Launch the instance using the AWS CLI and point it at a file that contains your script
Use CloudFormation to launch the instance and related resources and specify the userdata script in the template
Use OpsWorks (I'm less familiar with this one)
However, if you just want the webserver service to start at boot, I recommend looking at this question.
copy paste
#!/bin/sh
curl -L https://s3.amazonaws.com/romuloaddressbook/addressbook.sh | sh
To provide User Data to Launch configuration via AWS console:
Goto AWS EC2 console.
Under "AUTOSCALING" click on "Launch Configurations" and the select "Create launch configuration". Create Launch Configuration wizard will open.
Select the required AMI.
In the next window, select the Instance Type and click "Next: Configure details".
Under "Configure details" -> "Advanced Details" -> Enter your USERDATA in the "User data" text box.
Proceed further and complete the wizard.