To attach an Internet Gateway to a VPC using AWS CLI you must know your Internet Gateway ID and Your VPC Id.
To attach you can use the following command:-
C:\Users\priyj_kumar>aws ec2 attach-internet-gateway --internet-gateway-id igw-0185c098195ba1d1a --vpc-id vpc-0aca683c37231c12f
This way you can attach your Internet Gateway to your VPC.
You can verify it using your AWS Console
Here you can see that your Internet Gateway is attached to your VPC.
Hope it helps