‫Now let's talk about VPC flow logs.
‫VPC flow logs are a log of all the IP traffic going
‫through your interfaces.
‫So you can get a VPC flow log, a subnet flow log
‫or even an elastic tech network interface flow log
‫to see the traffic going in
‫and out of your EC2 instances for example.
‫By enabling the flow log, we can monitor
‫and troubleshoots for connectivity issues.
‫For example, if a subnet cannot connect to the internet,
‫or a subnet cannot connect to another subnet,
‫or the internet cannot access a subnet,
‫this will be captured by the VPC flow log
‫and we can look at it to get to the root cause of it.
‫So this is super important because
‫on top of getting information out
‫of our EC2 instances,
‫we also get information
‫for elastic load balancers, ElastiCache,
‫RDS, Aurora, et cetera, et cetera.
‫And the VPC flow logs can go to S3, CloudWatch Logs,
‫and Kinesis Data Firehose.
‫Next we have VPC peering and VPC peering is to connect
‫to VPC privately using the network from AWS
‫and to make them behave
‫as if they were part from the same network.
‫So this is an example.
‫We have VPC A and VPC B
‫and we can peer them together and as soon as that's done
‫then they will have the same network
‫or behave as if they were in the same network.
‫So for this, you need to make sure
‫that the IP address's range do not overlap.
‫If they do overlap
‫then you cannot establish a VPC peering connection.
‫The other thing is that a VPC peering connection
‫is not transitive.
‫That means that if you add a new VPC, for example, VPC C,
‫and you create a peering connection between VPC A and VPC C
‫then that means that VPC B and C cannot talk
‫to each other yet.
‫If you want to have VPC B and C talk to one another
‫then you would need to create another peering connection
‫between your VPC B and C.
‫So let's go in the console to see how this works.
‫So let's explore VPC flow logs.
‫For this, you click
‫on your VPC and then click on flow logs.
‫And here you can create a flow log.
‫So we'll just have a look at the options for flow logs.
‫So you can name it,
‫you can say filters if you want all traffic,
‫just accepted traffic, or rejected traffic.
‫What is the maximum aggregation interval.
‫Do you want it to be
‫in 10 minutes interval or one minute interval?
‫And then what is the destination.
‫For example, you can send to CloudWatch Logs.
‫You can send to an Amazon S3 bucket, or you can send
‫to Kinesis Data Firehose in the same or different accounts.
‫And based on the option you choose
‫you have to specify different parameters.
‫For example, for CloudWatch Logs, the log group
‫as well as an IAM role.
‫And finally, here's the log record format
‫which is going to create some information
‫on the VPC flow logs such as version, account id,
‫interface id, source address, destination address,
‫source port, destination ports, protocol, packets,
‫bytes, start, end, action, log-status.
‫So that's it for the VC flow logs.
‫And regarding VPC peering connection, you will go
‫on the left hand side and you find peering connections.
‫So here we can create a peering connection.
‫So we can name it.
‫We have to select a local VPC to peer with
‫so that's called the requester VPC.
‫And then you have to select another VPC to peer with.
‫It could be in my accounts or it could be
‫in another accounts, and then it could be in this region
‫or it could be in another region.
‫For example, let's choose Cape Town Africa.
‫And then we need to enter the VPC id.
‫Once you've done that
‫you can just create a peering connection.
‫And then if accepted
‫then the two networks will behave as one
‫which is the whole point of using VPC peering connections.
‫So I don't have an extra VPC to show you right now
‫but you get the idea.
‫So that's it.
‫In this lecture
‫we've seen VPC flow logs to capture traffic information,
‫or VPC, as well as VPC peering connections.
‫I hope you liked it and I will see you in the next lecture.