Recently, I have started learning AWS Cloud Formation (CF) and AWS Serverless Application Model (SAM). I found that there differences when it comes to syntax in its template files. For instance, to create a Lambda resource in SAM, we would declare something like this:-
Resources:
HelloLambda:
Type: AWS::Serverless::Function
Whereas in CF, we declare by this:-
Resources:
HelloLambda:
Type: AWS::Lambda::Function
Not just that there are few attributes/properties when it comes to Lambda that differs in SAM than a CF.
I'm still not able to get my head around and confused. I have a few queries and would really appreciate if you can clear my doubts:-
- What was the need for SAM, if CF was already doing great things as IaC (Infrastructure as Code) for AWS Cloud?
- Why somebody would prefer to SAM instead of CF?
- Any finally, can I use the SAM resources (syntactical) to write in CF or vice-versa, for instance, can I declare a Lambda using the following syntax in a normal CF template or vice-versa:-
Resources: HelloLambda: Type: AWS::Serverless::Function
Cheers,