0

I am having three instances in AWS. I have to start each instance by logging into the account and then start it manually. I want to start it using python by just running a script so that I don't need to login to the AWS account and start the service manually. Here are my instance types.

Is there any way I could do it? I am new to AWS so not finding a way to do it.

ws

1 Answer 1

3

The easiest method would be to use the AWS Command-Line Interface (CLI):

aws ec2 start-instances --instance-ids i-11111 i-2222 i-3333

If you have not previously used the AWS CLI, you will first need to run aws configure and provide your IAM User credentials (Access Key + Secret Key).

You can also use a Python script to do this, using the boto3 SDK and the start_instances() command.

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

3 Comments

while using boto3 sdk, do I need to use AWS cli or can directly use python?
you can do both. use boto3 or the aws cli
The AWS CLI is actually a Python program that uses boto underneath. You can certainly write your own Python script to do this OR you can use the AWS CLI. For such a simple task as starting a few instances, I'd recommend using the AWS CLI command. More complex tasks are best done in a language (such as Python) -- for example, iterating through instances and performing tasks on each instance.

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.