Use Instance profile instead of access/secret key

Hi,

I am writing a CloudFormation script to create a private instance from WebPageTest AMI

All works when I put access/secret key in the userdata

But I am trying to use an Instance profile (AWS::IAM::InstanceProfile) attached to the EC2 with these roles (AWS::IAM::Role):
AmazonEC2FullAccess
AmazonS3FullAccess

But it don’t work :frowning:

Is it possible to do it?

If yes, how can I do ?

Thanks
Antonio