EP-95 | How to Create VPC Security Group and attach to EC2 instance Python 3 Boto3 | Automate AWS

  Рет қаралды 4,431

Pythoholic

Pythoholic

Күн бұрын

Пікірлер: 20
@Pythoholic
@Pythoholic 4 жыл бұрын
Link for the Code to create EC2 instance with Security Groups: github.com/Pythoholic/pythoholic_demo_aws/blob/master/AWSPYDemo/sourcefiles/aws_ec2_advanced.py Join this channel to get access to perks: kzbin.info/door/lCB_NDN1-cmbhIEPQcf83Ajoin
@nadeem5836
@nadeem5836 2 жыл бұрын
I have been stuck for around 30 min to get this resolved this string issue [permission & permissions] & later you explained. Anyway, Thanks a Lots!!
@ashu9103
@ashu9103 4 жыл бұрын
You’re best 😊
@ayyappama3721
@ayyappama3721 4 жыл бұрын
Your videos very helpfull, Please make video on how to mount ssl certificate on ec2 using cloudflare(https for webserver)
@Pythoholic
@Pythoholic 4 жыл бұрын
Sure 👍
@rodrigofernandez9582
@rodrigofernandez9582 2 жыл бұрын
if vpc["Tags"][0]["Value"].__contains__("Default"): KeyError: 'Tags' help pls
@Pythoholic
@Pythoholic 2 жыл бұрын
please check if the vpc has tag key and then check if it is getting the values
@rodrigofernandez9582
@rodrigofernandez9582 2 жыл бұрын
@@Pythoholic I have another question, how do I make my project run on the assigned IP of ec2? and thank you
@roya2045
@roya2045 3 жыл бұрын
Hi Pytho are all of your aws tutorial video sets complete have you covered everything?
@Pythoholic
@Pythoholic 3 жыл бұрын
There are a few simple services left that but most are done. 95 percent it's done. But I keep.on adding more to give more information
@roya2045
@roya2045 3 жыл бұрын
@@Pythoholic cool bro thanks keep the pace up upload videos on regular basis if possible thanks again!!
@시몬-s8w
@시몬-s8w Жыл бұрын
when i change if vpc["Tags"][0]["Value"].__contains__("Default"): to if vpc["Tags"][0]["Value"].__contains__("my"): to use my_vpc but def create_security_group uses Default vpc to find SG. I just paste your code and change default -> my could you fix tis issue? thankyou anyway
@Pythoholic
@Pythoholic 11 ай бұрын
It seems like you're working with a script that interacts with AWS VPCs and you want to adjust it to work with a VPC tagged as "my_vpc" instead of the default VPC. The issue appears to be in the way the script is checking the VPC tags to identify the correct VPC. Here's a more flexible approach to modify the script: 1. **Identify VPCs by Tags Dynamically**: Instead of hardcoding the tag value, use a variable to store the tag value you're interested in (e.g., "my_vpc"). This makes it easy to change the targeted VPC without altering the code structure. 2. **Handle Multiple Tags and Case Sensitivity**: Tags can be case-sensitive and VPCs can have multiple tags. Ensure your code iterates through all tags and performs a case-insensitive comparison. Here's a revised snippet based on your description: ```python # Set your desired tag value desired_tag_value = "my_vpc" # Flag to identify if the desired VPC is found desired_vpc_found = False # Iterate through all VPCs for vpc in vpcs: # Check if 'Tags' key exists in vpc if "Tags" in vpc: # Iterate through each tag in the VPC for tag in vpc["Tags"]: # Check if the 'Value' of the tag matches your desired value (case-insensitive) if tag["Key"] == "Name" and tag["Value"].lower() == desired_tag_value.lower(): desired_vpc_found = True # Your code to create a security group or perform other actions on the desired VPC # ... break # Exit the loop after finding the desired VPC # Break out of the outer loop if the desired VPC is found if desired_vpc_found: break # Check if the desired VPC was not found if not desired_vpc_found: print(f"No VPC found with the tag value: {desired_tag_value}") ``` This code snippet does the following: 1. Iterates through each VPC and its tags. 2. Checks if the 'Name' tag of a VPC matches the desired value ('my_vpc'), case-insensitively. 3. If a match is found, it flags that the desired VPC is found, and you can add your logic to create a security group or perform other actions. 4. If after the iteration no desired VPC is found, it prints a message. Remember to replace the comment `# Your code to create a security group or perform other actions on the desired VPC` with the actual code that creates the security group or performs other actions.
@sagarkuvlekar6684
@sagarkuvlekar6684 3 жыл бұрын
How we can schedule ec2 instance for only working hours and from mon-fri..???
@Pythoholic
@Pythoholic 3 жыл бұрын
You can go for a scheduled ec2 instance or more complicated way run a lambda script to start and stop instances using a cron that runs it periodically as per ur requirement
@shamanthreddy8154
@shamanthreddy8154 4 жыл бұрын
Can You do video on TRANSIT GATEWAY
@vaibhavbansal7225
@vaibhavbansal7225 4 жыл бұрын
How many more videos will come for completing the course?
@Pythoholic
@Pythoholic 4 жыл бұрын
It's already completed, it's like almost 95 percent completed but I keep on adding videos to.this so that I can share extra details that are important
@vaibhavbansal7225
@vaibhavbansal7225 4 жыл бұрын
@@Pythoholic Thank you so much for this wonderful course. Hats off for all the hard work you have done for making this series look easy and understandable.
@Pythoholic
@Pythoholic 4 жыл бұрын
Thanks bro i hope it helps. That's the goal. 👍
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
How to create a CloudWatch Alarm for CPU utilization?
22:51
Pythoholic
Рет қаралды 32 М.
AWS Security - AWS Key Management Service | Fully Visualized
50:14
DeepSeek R1 Just Revolutionized AI Forever
21:06
Cole Medin
Рет қаралды 46 М.
This AI Robot Is Doing the Impossible - Unitree x ElizaWakesUp
9:30
AI Revolution
Рет қаралды 163 М.
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.