@@ -14,7 +14,6 @@ Metadata:
1414 - ImageId
1515 - VpcId
1616 - SubnetId
17- - ManagedPolicyArn
1817 - Label :
1918 default : " FSxN Configuration"
2019 Parameters :
@@ -69,9 +68,7 @@ Metadata:
6968 default : " Linux User Data Script URL"
7069 WindowsUserDataUrl :
7170 default : " Windows User Data Script URL"
72- ManagedPolicyArn :
73- default : " IAM Managed Policy ARN"
74-
71+
7572Parameters :
7673 OperationSystem :
7774 Type : String
@@ -88,14 +85,6 @@ Parameters:
8885 KeyName :
8986 Type : AWS::EC2::KeyPair::KeyName
9087 Description : Name of an existing EC2 KeyPair
91- ImageId :
92- Type : AWS::EC2::Image::Id
93- Description : AMI ID for the instance
94- AllowedValues :
95- # Amazon Linux 2023 Kernel-6.1 AMI (us-east-1)
96- - ami-0b09ffb6d8b58ca91
97- # Microsoft Windows Server 2025 Base (us-east-1)
98- - ami-0e3c2921641a4a215
9988 VpcId :
10089 Type : AWS::EC2::VPC::Id
10190 Description : VPC ID
@@ -136,9 +125,15 @@ Parameters:
136125 Type : String
137126 Default : https://raw.githubusercontent.com/NetApp/FSx-ONTAP-samples-scripts/refs/heads/main/Management-Utilities/ec2-user-data-iscsi-create-and-mount/windows_userData.ps1
138127 Description : URL to Windows user data script
139- ManagedPolicyArn :
140- Type : String
141- Description : IAM managed policy ARN to attach to the EC2 instance role
128+ LatestLinuxAMI :
129+ Type : ' AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
130+ Default : ' /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64'
131+ Description : ' The latest Amazon Linux 2 AMI ID'
132+ LatestWindowsAMI :
133+ Type : ' AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
134+ Default : ' /aws/service/ami-windows-latest/TPM-Windows_Server-2025-English-Full-Base'
135+ Description : ' The latest Windows Server AMI ID'
136+
142137Conditions :
143138 IsLinux : !Equals [ !Ref OperationSystem, "Linux" ]
144139 IsWindows : !Equals [ !Ref OperationSystem, "Windows" ]
@@ -171,8 +166,17 @@ Resources:
171166 Service : ec2.amazonaws.com
172167 Action : sts:AssumeRole
173168 Path : /
174- ManagedPolicyArns :
175- - !Ref ManagedPolicyArn
169+
170+ Policies :
171+ - PolicyName : " LambdaPolicy"
172+ PolicyDocument :
173+ Version : " 2012-10-17"
174+ Statement :
175+ - Effect : " Allow"
176+ Action :
177+ - " secretsManager:GetSecretValue"
178+ Resource :
179+ - !Sub " arn:aws:secretsmanager:${AWSRegion}:${AWS::AccountId}:secret:${SecretName}*"
176180
177181 EC2InstanceProfile :
178182 Type : AWS::IAM::InstanceProfile
@@ -183,7 +187,7 @@ Resources:
183187 Type : AWS::EC2::Instance
184188 Properties :
185189 InstanceType : !Ref InstanceType
186- ImageId : !Ref ImageId
190+ ImageId : !If [IsLinux, ! Ref LatestLinuxAMI, !Ref LatestWindowsAMI]
187191 KeyName : !Ref KeyName
188192 SecurityGroupIds :
189193 - !Ref EC2InstanceSecurityGroup
0 commit comments