bhbsoft / fluffycloud

fluffycloud
0 stars 0 forks source link

Create and setup VPC for Scenario1 #7

Open armondhonore opened 10 years ago

armondhonore commented 10 years ago

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Scenario1.html

using the CLI

create a json opbject that will create a default network that implements senerio 1 to create a virtual private cloud that uses one t2.micro

amitmetadesi commented 10 years ago

For creating the scenario 1 is like we need to execute several commands sequentially using the AWS cli. Steps will be :

  1. Create a VPC instance Default VPC create command create a VPC with given CIDR, Routing table, DHCP options set and a network acl attached to the VPC.
  2. Create a subnet and attach it with VPC in step1.
  3. Create a Security Group.
  4. Add Inbound & Outbound rules to security group created in step3 , then attach it to VPC created in step1.
  5. Create and Launch an t2.micro instance in the VPC created in step 1.
  6. Create a new Elastic IP address.
  7. Associate elastic IP address with instance created and launched in step 5.

So overview of steps to create scenario 1.

Queries: Say we have scenario1.json

  1. Do we need to maintain all the commands with proper IDs in JSON. or
  2. Do we need to maintain the flow of commands in the JSON.
  3. How we gonna use the scenario1.json ? Do we need something like CLIExecutor to execute the commands present in the json?
  4. How this JSON gonna maintain the dynamic IDs created for different commands like vpc id, subnet id, instance id etc ? For this we have to like read the output and get the required ID to execute further commands. To achieve this we have to create stubs for reponses also.

Other viewpoint.

  1. We have the default JSON for commands required to create scenario1.
  2. Configure the APIs with proper JSON and XML reponses in CLOUDMOCK module.
  3. Now user have all the resources to create the scenario1.
  4. CloudMock gonna give back the mock reponse irrespective of what IDs passed.
amitmetadesi commented 10 years ago

Is there any way to assign in which VPC user wants to launch the instance using aws cli. Didn't find any command to perform this step. It can be performed using AWS console using launch instance.

armondhonore commented 10 years ago

http://docs.aws.amazon.com/cli/latest/userguide/cli-ec2-launch.html

EC2-VPC

The following command launches a t1.micro instance in the specified subnet:

$ aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type t1.micro --key-name MyKeyPair --security-group-ids sg-xxxxxxxx --subnet-id subnet-xxxxxxxx

amitmetadesi commented 10 years ago

Done with the scenario1 network creation. Following commands are executed in sequence to create scenario 1:

  1. Create a VPC instance
  2. Create a Security Group
  3. Add Inbound Rules
  4. Add OutBound Rules
  5. Get ingress/egress rules info
  6. Create subnet
  7. Run instance with configured or default AMI
  8. Check instance state before proceeding
  9. Create Internet Gateway
  10. Attach Internet Gateway to VPC
  11. Create elastic IP address
  12. Associate elastic IP address to instance
  13. return Scenario1 Json reponse.

In case of any error we must delete the objects created before the error. It will be a kind of rollback in case of any exception. Please suggest.