Skip to content

Commit 3814af4

Browse files
muylucirKim
andauthored
Add Tier to tag setting (#276)
* Add Tier to tag setting * added the Tier tag to the resources * To pass the Tier tag as a parameter to the tenant-onboarding-app.yaml CloudFormation stack through handleOnboardingBaseProvisioned Co-authored-by: Kim <beomjun@c889f3b7db67.ant.amazon.com>
1 parent 2c3250e commit 3814af4

File tree

6 files changed

+80
-0
lines changed

6 files changed

+80
-0
lines changed

resources/tenant-onboarding-app.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Parameters:
2121
TenantId:
2222
Description: The GUID for the tenant
2323
Type: String
24+
Tier:
25+
Description: The tier this tenant is onboading into
26+
Type: String
27+
Default: ''
2428
ServiceName:
2529
Description: Name for this application service
2630
Type: String
@@ -288,6 +292,8 @@ Resources:
288292
Tags:
289293
- Key: Tenant
290294
Value: !Ref TenantId
295+
- Key: Tier
296+
Value: !Ref Tier
291297
ClusterCapacityProviderAssociations:
292298
Type: AWS::ECS::ClusterCapacityProviderAssociations
293299
Condition: Ec2LaunchType
@@ -459,6 +465,8 @@ Resources:
459465
Tags:
460466
- Key: Tenant
461467
Value: !Ref TenantId
468+
- Key: Tier
469+
Value: !Ref Tier
462470
ContainerDefinitions:
463471
- Name:
464472
Fn::Join: ['', ['sb-', !Ref Environment, '-tenant-', !Select [0, !Split ['-', !Ref TenantId]], '-', !Ref ServiceResourceName]]
@@ -586,6 +594,8 @@ Resources:
586594
Tags:
587595
- Key: Tenant
588596
Value: !Ref TenantId
597+
- Key: Tier
598+
Value: !Ref Tier
589599
FsxWaitHandle:
590600
Condition: ProvisionFSx
591601
DependsOn: fsx
@@ -766,6 +776,8 @@ Resources:
766776
- Key: Tenant
767777
Value:
768778
!Ref TenantId
779+
- Key: Tier
780+
Value: !Ref Tier
769781
LaunchTemplateData:
770782
ImageId:
771783
Fn::If:
@@ -899,6 +911,8 @@ Resources:
899911
- Key: Tenant
900912
Value:
901913
!Ref TenantId
914+
- Key: Tier
915+
Value: !Ref Tier
902916
LinuxLaunchTemplate:
903917
Type: AWS::EC2::LaunchTemplate
904918
Condition: Ec2Linux
@@ -936,6 +950,8 @@ Resources:
936950
- Key: Tenant
937951
Value:
938952
!Ref TenantId
953+
- Key: Tier
954+
Value: !Ref Tier
939955
LaunchTemplateData:
940956
ImageId: !Ref AMZNLINUX2
941957
InstanceType: !Ref ClusterInstanceType
@@ -967,6 +983,8 @@ Resources:
967983
- Key: Tenant
968984
Value:
969985
!Ref TenantId
986+
- Key: Tier
987+
Value: !Ref Tier
970988
ALBTargetGroup:
971989
Type: AWS::ElasticLoadBalancingV2::TargetGroup
972990
Condition: IsPublic
@@ -998,6 +1016,8 @@ Resources:
9981016
Fn::Join: ['', ['sb-', !Ref Environment, '-tenant-', !Select [0, !Split ['-', !Ref TenantId]], '-', !Ref ServiceResourceName]]
9991017
- Key: Tenant
10001018
Value: !Ref TenantId
1019+
- Key: Tier
1020+
Value: !Ref Tier
10011021
ALBRule:
10021022
Condition: IsPublicHttp
10031023
Type: AWS::ElasticLoadBalancingV2::ListenerRule
@@ -1165,6 +1185,7 @@ Resources:
11651185
ThroughputCapacity: !Ref FileSystemThroughput
11661186
ECSSecurityGroup: !Ref ECSSecurityGroup
11671187
OntapVolumeSize: !Ref OntapVolumeSize
1188+
Tier: !Ref Tier
11681189
efs:
11691190
Type: AWS::CloudFormation::Stack
11701191
Condition: ProvisionEFS
@@ -1180,6 +1201,7 @@ Resources:
11801201
ECSSecurityGroup: !Ref ECSSecurityGroup
11811202
EncryptEFS: !Ref EncryptEFS
11821203
EFSLifecyclePolicy: !Ref EFSLifecyclePolicy
1204+
Tier: !Ref Tier
11831205
rds:
11841206
Type: AWS::CloudFormation::Stack
11851207
Condition: ProvisionRDS
@@ -1203,6 +1225,7 @@ Resources:
12031225
RDSPort: !Ref RDSPort
12041226
RDSDatabase: !Ref RDSDatabase
12051227
RDSBootstrap: !Ref RDSBootstrap
1228+
Tier: !Ref Tier
12061229
Outputs:
12071230
RdsEndpoint:
12081231
Condition: ProvisionRDS

resources/tenant-onboarding-efs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Parameters:
2121
TenantId:
2222
Description: The GUID for the tenant
2323
Type: String
24+
Tier:
25+
Description: The tier this tenant is onboading into
26+
Type: String
27+
Default: ''
2428
ServiceResourceName:
2529
Description: CloudFormation friendly version of the service name
2630
Type: String
@@ -87,6 +91,8 @@ Resources:
8791
Fn::Join: ['', ['sb-', !Ref Environment, '-tenant-', !Select [0, !Split ['-', !Ref TenantId]], '-', !Ref ServiceResourceName]]
8892
- Key: Tenant
8993
Value: !Ref TenantId
94+
- Key: Tier
95+
Value: !Ref Tier
9096
MountTargetA:
9197
Type: AWS::EFS::MountTarget
9298
Properties:

resources/tenant-onboarding-fsx.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Parameters:
1818
Environment:
1919
Description: Environment (test, uat, prod, etc.)
2020
Type: String
21+
Tier:
22+
Description: The tier this tenant is onboading into
23+
Type: String
24+
Default: ''
2125
TenantId:
2226
Description: The GUID for the tenant
2327
Type: String
@@ -136,6 +140,8 @@ Resources:
136140
Fn::Join: ['', ['sb-', !Ref Environment, '-fsx-tenant-', !Select [0, !Split ['-', !Ref TenantId]], '-', !Ref ServiceResourceName]]
137141
- Key: Tenant
138142
Value: !Ref TenantId
143+
- Key: Tier
144+
Value: !Ref Tier
139145
FSxKeyAlias:
140146
Condition: CreateKey
141147
Type: AWS::KMS::Alias
@@ -405,6 +411,8 @@ Resources:
405411
Fn::Join: ['', ['sb-', !Ref Environment, '-tenant-', !Select [0, !Split ['-', !Ref TenantId]], '-', !Ref ServiceResourceName]]
406412
- Key: Tenant
407413
Value: !Ref TenantId
414+
- Key: Tier
415+
Value: !Ref Tier
408416
WindowsConfiguration: !If
409417
- FSxWindows
410418
-
@@ -457,6 +465,8 @@ Resources:
457465
Fn::Join: ['', ['sb-', !Ref Environment, '-tenant-', !Select [0, !Split ['-', !Ref TenantId]], '-', !Ref ServiceResourceName]]
458466
- Key: Tenant
459467
Value: !Ref TenantId
468+
- Key: Tier
469+
Value: !Ref Tier
460470
StorageVolume:
461471
Type: AWS::FSx::Volume
462472
Condition: FSxONTAP
@@ -475,6 +485,8 @@ Resources:
475485
Fn::Join: ['', ['sb-', !Ref Environment, '-tenant-', !Select [0, !Split ['-', !Ref TenantId]], '-', !Ref ServiceResourceName]]
476486
- Key: Tenant
477487
Value: !Ref TenantId
488+
- Key: Tier
489+
Value: !Ref Tier
478490
FsxDnsNameRole:
479491
Type: AWS::IAM::Role
480492
Properties:
@@ -557,6 +569,8 @@ Resources:
557569
Fn::Join: ['', ['sb-', !Ref Environment, '-tenant-', !Select [0, !Split ['-', !Ref TenantId]], '-', !Ref ServiceResourceName]]
558570
- Key: Tenant
559571
Value: !Ref TenantId
572+
- Key: Tier
573+
Value: !Ref Tier
560574
InvokeGetFsxDnsName:
561575
Type: Custom::CustomResource
562576
DependsOn:

resources/tenant-onboarding-rds.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ Parameters:
6666
RDSBootstrap:
6767
Description: Optional. The filename of the SQL bootstrap file.
6868
Type: String
69+
Tier:
70+
Description: The tier this tenant is onboading into
71+
Type: String
72+
Default: ''
6973
Conditions:
7074
Aurora:
7175
Fn::Or:
@@ -162,6 +166,8 @@ Resources:
162166
Fn::Join: ['', ['sb-', !Ref Environment, '-rds-tenant-', !Select [0, !Split ['-', !Ref TenantId]], '-', !Ref ServiceResourceName]]
163167
- Key: Tenant
164168
Value: !Ref TenantId
169+
- Key: Tier
170+
Value: !Ref Tier
165171
EncryptionKeyAlias:
166172
Condition: SupportsEncryption
167173
Type: AWS::KMS::Alias
@@ -204,6 +210,8 @@ Resources:
204210
Tags:
205211
- Key: Tenant
206212
Value: !Ref TenantId
213+
- Key: Tier
214+
Value: !Ref Tier
207215
RDSAuroraInstance:
208216
Type: AWS::RDS::DBInstance
209217
Condition: Aurora
@@ -216,6 +224,8 @@ Resources:
216224
Tags:
217225
- Key: Tenant
218226
Value: !Ref TenantId
227+
- Key: Tier
228+
Value: !Ref Tier
219229
RDSInstance:
220230
Type: AWS::RDS::DBInstance
221231
Condition: NotAurora
@@ -254,6 +264,8 @@ Resources:
254264
Tags:
255265
- Key: Tenant
256266
Value: !Ref TenantId
267+
- Key: Tier
268+
Value: !Ref Tier
257269
RDSBootstrapDatabaseRole:
258270
Type: AWS::IAM::Role
259271
Condition: BootstrapDatabase
@@ -354,6 +366,8 @@ Resources:
354366
Tags:
355367
- Key: Tenant
356368
Value: !Ref TenantId
369+
- Key: Tier
370+
Value: !Ref Tier
357371
AuroraWaitHandle:
358372
Type: AWS::CloudFormation::WaitConditionHandle
359373
Condition: Aurora

resources/tenant-onboarding.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,16 @@ Resources:
6464
- Key: Name
6565
Value:
6666
Fn::Join: ['', ['sb-', !Ref Environment, '-tenant-', !Select [0, !Split ['-', !Ref TenantId]]]]
67+
- Key: Tier
68+
Value: !Ref Tier
6769
InternetGateway:
6870
Type: AWS::EC2::InternetGateway
6971
Properties:
7072
Tags:
7173
- Key: Tenant
7274
Value: !Ref TenantId
75+
- Key: Tier
76+
Value: !Ref Tier
7377
AttachGateway:
7478
Type: AWS::EC2::VPCGatewayAttachment
7579
Properties:
@@ -85,6 +89,8 @@ Resources:
8589
- Key: Name
8690
Value:
8791
Fn::Join: ['', ['sb-', !Ref Environment, '-public-tenant-', !Select [0, !Split ['-', !Ref TenantId]]]]
92+
- Key: Tier
93+
Value: !Ref Tier
8894
RoutePublic:
8995
Type: AWS::EC2::Route
9096
DependsOn: AttachGateway
@@ -104,6 +110,8 @@ Resources:
104110
- Key: Name
105111
Value:
106112
Fn::Join: ['', ['sb-', !Ref Environment, '-public-az1-tenant-', !Select [0, !Split ['-', !Ref TenantId]]]]
113+
- Key: Tier
114+
Value: !Ref Tier
107115
SubnetPublicARouteTable:
108116
Type: AWS::EC2::SubnetRouteTableAssociation
109117
Properties:
@@ -121,6 +129,8 @@ Resources:
121129
- Key: Name
122130
Value:
123131
Fn::Join: ['', ['sb-', !Ref Environment, '-public-az2-tenant-', !Select [0, !Split ['-', !Ref TenantId]]]]
132+
- Key: Tier
133+
Value: !Ref Tier
124134
SubnetPublicBRouteTable:
125135
Type: AWS::EC2::SubnetRouteTableAssociation
126136
Properties:
@@ -138,6 +148,8 @@ Resources:
138148
- Key: Name
139149
Value:
140150
Fn::Join: ['', ['sb-', !Ref Environment, '-private-az1-tenant-', !Select [0, !Split ['-', !Ref TenantId]]]]
151+
- Key: Tier
152+
Value: !Ref Tier
141153
SubnetPrivateB:
142154
Type: AWS::EC2::Subnet
143155
Properties:
@@ -150,6 +162,8 @@ Resources:
150162
- Key: Name
151163
Value:
152164
Fn::Join: ['', ['sb-', !Ref Environment, '-private-az2-tenant-', !Select [0, !Split ['-', !Ref TenantId]]]]
165+
- Key: Tier
166+
Value: !Ref Tier
153167
RouteTablePrivate:
154168
Type: AWS::EC2::RouteTable
155169
Properties:
@@ -160,6 +174,8 @@ Resources:
160174
- Key: Name
161175
Value:
162176
Fn::Join: ['', ['sb-', !Ref Environment, '-private-tenant-', !Select [0, !Split ['-', !Ref TenantId]]]]
177+
- Key: Tier
178+
Value: !Ref Tier
163179
Subnet1RouteTableAssociation:
164180
Type: AWS::EC2::SubnetRouteTableAssociation
165181
Properties:
@@ -184,6 +200,8 @@ Resources:
184200
- Key: Name
185201
Value:
186202
Fn::Join: ['', ['sb-', !Ref Environment, '-tenant-', !Select [0, !Split ['-', !Ref TenantId]]]]
203+
- Key: Tier
204+
Value: !Ref Tier
187205
TransitGatewayId:
188206
Fn::Join: ['', ['{{resolve:ssm:/saas-boost/', !Ref Environment, '/TRANSIT_GATEWAY}}']]
189207
VpcId: !Ref VPC
@@ -219,6 +237,8 @@ Resources:
219237
Tags:
220238
- Key: Tenant
221239
Value: !Ref TenantId
240+
- Key: Tier
241+
Value: !Ref Tier
222242
ALBSecurityGroup:
223243
Type: AWS::EC2::SecurityGroup
224244
Properties:
@@ -280,6 +300,8 @@ Resources:
280300
Tags:
281301
- Key: Tenant
282302
Value: !Ref TenantId
303+
- Key: Tier
304+
Value: !Ref Tier
283305
RecordSetAlias:
284306
Type: AWS::Route53::RecordSet
285307
Condition: CreateSubDomainAlias

services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ protected void handleOnboardingBaseProvisioned(Map<String, Object> event, Contex
998998
// TODO rework these last 2?
999999
templateParameters.add(Parameter.builder().parameterKey("MetricsStream").parameterValue("").build());
10001000
templateParameters.add(Parameter.builder().parameterKey("EventBus").parameterValue(SAAS_BOOST_EVENT_BUS).build());
1001+
templateParameters.add(Parameter.builder().parameterKey("Tier").parameterValue(tier).build());
10011002
for (Parameter p : templateParameters) {
10021003
LOGGER.info("{} => {}", p.parameterKey(), p.parameterValue());
10031004
if (p.parameterValue() == null) {

0 commit comments

Comments
 (0)