CloudFormation With API Gateway
CloudFormation With API Gateway
```yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: CloudFormation template for an application backend with API Gateway
Resources:
# Define the Lambda function for the backend
BackendLambdaFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: MyBackendFunction
Handler: index.handler
Role: !GetAtt BackendLambdaExecutionRole.Arn
Code:
S3Bucket: your-s3-bucket
S3Key: your-lambda-code.zip
Runtime: nodejs14.x
Outputs:
BackendApiUrl:
Description: URL for the backend API
Value: !Sub https://${BackendApiGateway}.execute-api.$
{AWS::Region}.amazonaws.com/prod/backend
```