Yaroslav Bulatov
Yaroslav Bulatov

Reputation: 57883

Creating default VPC using boto3?

Is there a way to do an equivalent of aws ec2 create-default-vpc using boto3? (more generally, I'm wondering if there is a way to figure out boto3/botocore equivalent of aws CLI directive)

Upvotes: 1

Views: 794

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269091

Use create_default_vpc():

import boto3

client = boto3.client('ec2', region_name = 'ap-southeast-2') # Adjust as desired

client.create_default_vpc()

It's all in the boto3 documentation! (In fact, the AWS CLI uses botocore!)

Upvotes: 4

Related Questions