Skip to content

Conversation

@BhavyaBojanapalli
Copy link

@BhavyaBojanapalli BhavyaBojanapalli commented Mar 15, 2022

Generated description

Below is a concise technical summary of the changes proposed in this PR:

graph LR
main_("__main__"):::added
awslogin_("awslogin"):::added
vpc_creation_("vpc_creation"):::added
create_ig_("create_ig"):::added
create_security_group_("create_security_group"):::added
create_subnet_("create_subnet"):::added
create_instances_("create_instances"):::added
create_alb_("create_alb"):::added
create_tg_("create_tg"):::added
createlistner_("createlistner"):::added
regis_targets_("regis_targets"):::added
BOTO3_EC2_RESOURCE_("BOTO3_EC2_RESOURCE"):::added
BOTO3_EC2_CLIENT_("BOTO3_EC2_CLIENT"):::added
BOTO3_ELBV2_CLIENT_("BOTO3_ELBV2_CLIENT"):::added
main_ -- "Establishes AWS session with access credentials." --> awslogin_
main_ -- "Creates a new VPC and returns its ID." --> vpc_creation_
main_ -- "Creates and attaches internet gateway to VPC." --> create_ig_
main_ -- "Creates security groups for EC2 and ALB." --> create_security_group_
main_ -- "Creates multiple subnets within the VPC." --> create_subnet_
main_ -- "Launches EC2 instances with user data script." --> create_instances_
main_ -- "Creates ALB with specified subnets and security group." --> create_alb_
main_ -- "Creates target group for ALB in VPC." --> create_tg_
main_ -- "Creates ALB listener forwarding to target group." --> createlistner_
main_ -- "Registers EC2 instances as ALB target group targets." --> regis_targets_
create_instances_ -- "Uses boto3 EC2 resource to launch instances." --> BOTO3_EC2_RESOURCE_
create_security_group_ -- "Uses boto3 EC2 client to create security groups." --> BOTO3_EC2_CLIENT_
create_alb_ -- "Uses boto3 ELBv2 client to create ALB." --> BOTO3_ELBV2_CLIENT_
classDef added stroke:#15AA7A
classDef removed stroke:#CD5270
classDef modified stroke:#EDAC4C
linkStyle default stroke:#CBD5E1,font-size:13px
Loading

Deploys an AWS environment by provisioning a Virtual Private Cloud (VPC), multiple subnets, security groups, and EC2 instances, then configures an Application Load Balancer (ALB) with target groups and listeners to distribute traffic to the instances.

Latest Contributors(0)
UserCommitDate
This pull request is reviewed by Baz. Review like a pro on (Baz).

Comment on lines +46 to +51
def get_ec2id(data):
for reservation in data["Reservations"]:
for instance in reservation["Instances"]:
ec2 = boto3.resource('ec2')
response = ec2.Instance(instance["InstanceId"])
return response
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The get_ec2id function iterates through all instances but only returns the last one found. This causes instance1, instance2, and instance3 to all reference the same instance when registering targets.

Suggested change
def get_ec2id(data):
for reservation in data["Reservations"]:
for instance in reservation["Instances"]:
ec2 = boto3.resource('ec2')
response = ec2.Instance(instance["InstanceId"])
return response
def get_ec2id(data):
for reservation in data["Reservations"]:
for instance in reservation["Instances"]:
ec2 = boto3.resource('ec2')
response = ec2.Instance(instance["InstanceId"])
return response

Finding type: Logical Bugs

print('Successfully created target group - ', tgId)
return tgId

def createlistner(lb, lbId, tgId):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should createlistner be createlistener? The 'e' seems to be missing.


Finding type: Naming and Typos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant