@@ -296,8 +296,8 @@ Resources:
296
296
Description : Allow outbound access
297
297
SecurityGroupIngress :
298
298
- IpProtocol : tcp
299
- FromPort : !Ref iECRStreamlitPort
300
- ToPort : !Ref iECRStreamlitPort
299
+ FromPort : 8501
300
+ ToPort : 8501
301
301
CidrIp : 0.0.0.0/0
302
302
Description : Inbound only on Streamlit port
303
303
VpcId : !Ref StreamlitVPC
@@ -406,7 +406,7 @@ Resources:
406
406
Type : AWS::ElasticLoadBalancingV2::Listener
407
407
Properties :
408
408
LoadBalancerArn : !Ref LoadBalancer
409
- Port : !Ref iECRStreamlitPort
409
+ Port : 8501
410
410
Protocol : HTTP
411
411
DefaultActions :
412
412
- Type : forward
@@ -417,13 +417,13 @@ Resources:
417
417
Properties :
418
418
Name : !Sub "${AWS::StackName}-tg-http"
419
419
VpcId : !Ref StreamlitVPC
420
- Port : !Ref iECRStreamlitPort
420
+ Port : 8501
421
421
Protocol : HTTP
422
422
TargetType : ip
423
423
HealthCheckEnabled : true
424
424
HealthCheckIntervalSeconds : 60
425
425
HealthCheckPath : " /_stcore/health"
426
- HealthCheckPort : !Ref iECRStreamlitPort
426
+ HealthCheckPort : 8501
427
427
HealthCheckProtocol : HTTP
428
428
TargetGroupAttributes :
429
429
- Key : stickiness.enabled
@@ -449,13 +449,16 @@ Resources:
449
449
TaskRoleArn : !Ref TaskRole
450
450
ContainerDefinitions :
451
451
- Name : " streamlit"
452
- Image : !Sub "${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/docsearch-ecr "
452
+ Image : !Sub "${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/urs-ui "
453
453
MemoryReservation : 2048
454
454
Cpu : 2048
455
455
Memory : 4096
456
456
Essential : true
457
457
PortMappings :
458
- - ContainerPort : !Ref iECRStreamlitPort
458
+ - ContainerPort : 8501
459
+ Environment :
460
+ - Name : BACKEND_STACK_NAME
461
+ Value : !Sub "{AWS::StackName}"
459
462
LogConfiguration :
460
463
LogDriver : awslogs
461
464
Options :
@@ -500,24 +503,57 @@ Resources:
500
503
Statement :
501
504
- Effect : Allow
502
505
Principal :
503
- Service : ecs-tasks.amazonaws.com
506
+ Service :
507
+ - ecs.amazonaws.com
508
+ - ecs-tasks.amazonaws.com
504
509
Action : ' sts:AssumeRole'
505
510
Policies :
506
- - PolicyName : root
511
+ - PolicyName : cw
507
512
PolicyDocument :
508
513
Version : " 2012-10-17"
509
514
Statement :
510
515
- Effect : Allow
511
516
Action :
512
- - " ecr:GetAuthorizationToken"
513
- - " ecr:BatchCheckLayerAvailability"
514
- - " ecr:GetDownloadUrlForLayer"
515
- - " ecr:BatchGetImage"
516
- - " logs:CreateLogStream"
517
- - " logs:PutLogEvents"
518
- - " logs:CreateLogGroup"
517
+ - logs:CreateLogGroup
518
+ - logs:CreateLogStream
519
+ - logs:PutLogEvents
519
520
Resource : ' *'
520
-
521
+ - PolicyName : s3-read-access-policy
522
+ PolicyDocument :
523
+ Version : " 2012-10-17"
524
+ Statement :
525
+ - Effect : Allow
526
+ Action :
527
+ - s3:GetObject
528
+ - s3:ListBucket
529
+ - s3:GetBucketLocation
530
+ - s3:GetObjectVersion
531
+ - s3:GetLifecycleConfiguration
532
+ - s3:PutObject
533
+ Resource :
534
+ - !Sub " arn:aws:s3:::unicorn-inv-${AWS::StackName}-${AWS::AccountId}"
535
+ - !Sub " arn:aws:s3:::unicorn-inv-${AWS::StackName}-${AWS::AccountId}/*"
536
+ - PolicyName : ecr_access_policy
537
+ PolicyDocument :
538
+ Version : " 2012-10-17"
539
+ Statement :
540
+ - Effect : Allow
541
+ Action :
542
+ - ecr:GetAuthorizationToken
543
+ - ecr:BatchCheckLayerAvailability
544
+ - ecr:GetDownloadUrlForLayer
545
+ - ecr:BatchGetImage
546
+ Resource : " *"
547
+ - PolicyName : stack_describe_for_config
548
+ PolicyDocument :
549
+ Version : " 2012-10-17"
550
+ Statement :
551
+ - Effect : Allow
552
+ Action :
553
+ - cloudformation:DescribeStacks
554
+ Resource :
555
+ - !Sub " arn:aws:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${AWS::StackName}"
556
+ - !Sub " arn:aws:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${AWS::StackName}"
521
557
TaskRole :
522
558
Type : AWS::IAM::Role
523
559
Properties :
@@ -529,6 +565,9 @@ Resources:
529
565
Service : ecs-tasks.amazonaws.com
530
566
Action : ' sts:AssumeRole'
531
567
568
+
569
+
570
+
532
571
Outputs :
533
572
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
534
573
# Find out more about other implicit resources you can reference within SAM
0 commit comments