class Chef::Resource::AwsVpc

Represents an AWS VPC.

This allows you to finely control network access and security for your instances, creating a “walled garden” which cannot be accessed by the Internet (or get out to it) without explicitly enabling it through subnets, route tables, internet gateways and NATs.

VPCs and network security are closely related with the following other resources:

`name` is not guaranteed unique for an AWS account; therefore, Chef will store the VPC ID associated with this name in your Chef server in the data bag `data/aws_vpc/<name>`.

General documentation on AWS VPCs can be found here:

API documentation for the AWS Ruby SDK for VPCs (and the object returned from `aws_object` can be found here:

Public Instance Methods

aws_object() click to toggle source
# File lib/chef/resource/aws_vpc.rb, line 134
def aws_object
  driver, id = get_driver_and_id
  ec2_resource = ::Aws::EC2::Resource.new(driver.ec2)
  result = ec2_resource.vpc(id) if id
  result && exists?(result) ? result : nil
end
exists?(result) click to toggle source
# File lib/chef/resource/aws_vpc.rb, line 141
def exists?(result)
  return true if result.data
rescue ::Aws::EC2::Errors::InvalidVpcIDNotFound
  false
end