Getting error while creating VPC in AWS using Python boto3.

0 votes
botocore.exceptions.ParamValidationError: Parameter validation failed:
Missing required parameter in input: "Tags"
Unknown parameter in input: "Tag", must be one of: DryRun, Resources, Tags

This is the code I am using

import boto3
ec2 = boto3.resource('ec2')
vpc = ec2.create_vpc(CidrBlock='10.0.0.0/16')
vpc.create_tags(Tag=[{"Key":"TestVPC","Value":"default_vpc"}])
vpc.wait_until_available()
print(vpc.id)

Can someone help?

Dec 4, 2018 in AWS by Kanishk
• 880 points
228 views

1 answer to this question.

0 votes

The error clearly says the error you are getting. You have not used Tags instead used tag.

import boto3
ec2 = boto3.resource('ec2')
vpc = ec2.create_vpc(CidrBlock='10.0.0.0/16')
vpc.create_tags(Tags=[{"Key":"TestVPC","Value":"default_vpc"}])
vpc.wait_until_available()
print(vpc.id)
answered Dec 4, 2018 by Aniket

Related Questions In AWS

0 votes
1 answer

How to Pass the VPC ID while creating the Ec2 instance in AWS using Python Boto3

import boto3 ec2 = boto3.resource('ec2') instance = ec2.create_instances( ...READ MORE

answered Jan 29 in AWS by Priyaj
• 57,300 points
427 views
0 votes
1 answer

Pass account id of an AWS sub account using a variable as an argument in CloudWatch Alarm Actions with python (boto3)?

Python String and Integer concatenation >>> print("arn:aws:swf:us-east-2:{0}:action/actions/AWS_EC2.InstanceId.Stop/1.0".format(acccnum)) arn:aws:swf:us-east-2:12312312312312:action/actions/AWS_EC2.InstanceId.Stop/1.0 >>> print("arn:aws:swf:us-east-2:" ...READ MORE

answered Oct 5, 2018 in AWS by Priyaj
• 57,300 points
186 views
0 votes
1 answer
0 votes
1 answer

Getting error while deleting my VPC.

This is the code to delete the ...READ MORE

answered Dec 4, 2018 in AWS by Shuvodip Ghosh
82 views
0 votes
1 answer

How to delete a VPC using boto3?

You can view this answer here : https://www.edureka.co/community/32160/getting-error-while-deleting-my-vpc Before ...READ MORE

answered Dec 4, 2018 in AWS by Shuvodip Ghosh
396 views
0 votes
1 answer

Getting Error 503 when I using my site via DNS

add the server_name directive to your Nginx ...READ MORE

answered Apr 25, 2018 in AWS by Cloud gunner
• 4,280 points
161 views