Search

Create Instance

Last Updated: Feb 14, 2022

Articles

Use this function to create an instance in AWS with the given details.

Syntax

Create Instance (access_key, secret_key, image_id, instance_name, location, instance_type, keyname)

Parameters

Input Parameter Name Description
access_key AWS access_key_ID of the user
secret_key AWS Secret_access_key of the user
image_id ID of the instance in AWS
instance_name Name of instance to be created
location Location of the machine to be hosted
instance_type The type of the instance
keyname Key pair name in AWS for authentication

To know more about access_key and secret_key, click here.

To locate the Image ID and Instance Type, do the following:

  1. Log in to your AWS account.
  2. Navigate through the path: EC2 > Instances > Launch Instances.
  3. Image description
  4. Note the Image ID and click the Select button.
  5. Image description
  6. Note the Instance Type.
  7. Image description
To create the Keyname, do the following:
  1. Log in to your AWS account.
  2. Navigate through the path: EC2 > Key Pairs.
  3. Image description
  4. Enter the key pair name and click the Create key pair button
  5. Image description

Returns

Return Value Description
Output
  • On Success returns 1 | Instance ID
  • On Failure returns 0 | Error Message

Sample

Create Instance (XYZ, ABC, ami-000000, JiffyInstance, us-east-2, t2.nano, Key)

  • Uses the access key XYZ and the secret key ABC to login to AWS with image ID ami-000000, and the key name Key to authenticate, creates an instance JiffyInstance of type t2.nano in the location us-east-2
    Returns the Instance ID of the instance created.

To view all the AWS functions, click here.

Did you find what you were looking for?