Cloud provisioning question

Hey guys,
new guy to chef with a cloud provisioning here.
I've been watching and checking the decomentation but i still dont understand how this works.

Consider i want to provision a new machine in for example AWS.
I first create a recipe configuring the AWS credentials and machine

with_driver AWS

aws_key_pair 'my-aws-key' do
private_key_path "~boiardi/.ssh/my-aws-key.pem"
public_key_path "~boiardi/.ssh/my-aws-key.pub"
overwrite false # Set to true if you want to regenerate this each chef run
end

aws_launch_configuration 'example-windows-launch-configuration' do
image 'example-windows-image'
instance_type 't2.medium'
options security_groups: 'example-windows-sg',
key_pair: 'my-key-name',
ebs_optimized: false,
detailed_instance_monitoring: false,
iam_instance_profile: 'example-windows-role',
user_data:
EOF
end

then i would just create a another file with the machines?ยด
require file above

machine 'web' do
recipe 'apache'
end
machine 'db' do
recipe 'mysql'
end

and run the cookbook ?
or is it another way ?

Thanks in advance.