1
votes

I create ECS stack via cloudformation. Everything works fine. Due to a certain reason, I do not specify ServiceName for ECS service (Name: Service) in definition. However, I want to have it in outputs, after Cloudformation creates the stack. So for this purpose, I defined outputs like this:

Outputs:
  ECSServiceName:
    Description: Service Name I want to see
    Value: !GetAtt Service.ServiceName

When I run update CF Stack, I receive an error from AWS:

Requested attribute ServiceName must be a readonly property in schema for AWS::ECS::Service

Does this mean that I cannot receive it in outputs, if it wasn't strictly specified before? Or I made a mistake somewhere in Outputs definition?

1

1 Answers

0
votes

You have to export ECSServiceName from your template. Also the correct way to get ECS service name is !GetAtt Service.Name:


Outputs:
  ECSServiceName:
    Description: Service Name I want to see
    Value: !GetAtt Service.Name
    Export:
      Name: ECSServiceName

Then, in other templates, you can use ImportValue to reference the exported output:

!ImportValue ECSClusterName