I have a very simple CF template that creates an EC2 instance. The key pair is specified as a parameter. I would like the list of possible key pairs to be populated automatically.
Resources: MyInstance: Type: AWS::EC2::Instance Properties: AvailabilityZone: eu-west-2a ImageId: ami-0e80a462ede03e653 InstanceType: t3.nano KeyName: !Ref SSHKey Parameters: SSHKey: Type: String Description: name of the key pair to ssh into the instance AllowedValues: # populate automatically
How can I retrieve with CloudFormation the list of key pairs in the region where the template is being deployed?