The !GetAtt (Get Attribute) is a CloudFormation intrinsic function that helps you get the value of an attribute from a resource that has been created in your CloudFormation template.
In the example I showed earlier, !GetAtt NotificationFunction.Arn is getting the ARN (Amazon Resource Name) of a Lambda function named "NotificationFunction".
ResourceLogicalName: The logical name you gave to the resource in your template
AttributeName: The specific attribute you want to reference
This is particularly useful because:
You don't need to hardcode values
It ensures resources are properly linked together
CloudFormation will automatically resolve the actual value during deployment
It helps maintain dependencies between resources
For example, if you're creating a Lambda function and need to reference it in an EventBridge rule, you would:
!Ref
The !Ref (Reference) is another CloudFormation intrinsic function that allows you to refer to resources or parameters in your template. It's simpler than !GetAtt because it typically returns a default value for the resource.
For different resource types, !Ref returns different values: