# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 AWSTemplateFormatVersion: '2010-09-09' Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: Instance Configuration Details Parameters: - LinuxAmi - Label: default: Required Parameters Parameters: - env ParameterLabels: LinuxAmi: default: Amazon Machine Image for Applicaton Instances env: default: SDLC Environment of this VPC Parameters: LinuxAmi: Type : 'AWS::SSM::Parameter::Value' Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2' env: Type: String Description: SDLC Environment AllowedValues: - Dev - Test - Prod onPremPrefixList: Type: 'AWS::SSM::Parameter::Value' Description: SSM Parameter Store key for Prefix-List AllowedValues: - /Network/Dev/OnPrem-PrefixList - /Network/Test/OnPrem-PrefixList - /Network/Prod/OnPrem-PrefixList vpc: Type: 'AWS::SSM::Parameter::Value' Description: SSM Parameter Store key for VPC ID AllowedValues: - /Network/Dev/Vpc - /Network/Test/Vpc - /Network/Prod/Vpc subnet: Type: 'AWS::SSM::Parameter::Value' Description: SSM Parameter Store key for VPC ID AllowedValues: - /Network/Dev/PrivateSubnet1 - /Network/Test/PrivateSubnet1 - /Network/Prod/PrivateSubnet1 Resources: AppServer: Type: 'AWS::EC2::Instance' Properties: ImageId: !Ref LinuxAmi SubnetId: !Ref subnet InstanceType: t3.small Tags: - Key: Name Value: !Sub "AppServer1-${env}" SecurityGroupIds: - !Ref AppSecurityGroup # IamInstanceProfile: !Ref AppInstanceProfile BlockDeviceMappings: - DeviceName: /dev/xvda Ebs: VolumeType: gp2 DeleteOnTermination: true VolumeSize: 40 AppSecurityGroup: Type: 'AWS::EC2::SecurityGroup' Properties: GroupDescription: SSH Access from on-premises VpcId: !Ref vpc SecurityGroupIngress: - IpProtocol: tcp FromPort: 22 ToPort: 22 SourcePrefixListId: !Ref onPremPrefixList