Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 3.47 KB

04-resource-names-reference.md

File metadata and controls

36 lines (29 loc) · 3.47 KB

Cloudformation Resource Reference

To have consistent naming in the Cloudformation Templates that get deployed we've defined a standard name:

{Function Name}{Cloud Formation Resource Type}{ResourceName}{SequentialID or Random String}

  • Function Name this is optional for Resources that should be recreated when the function name gets changed. Those resources are also called function bound
  • Cloud Formation Resource Type e.g. S3Bucket
  • Resource Name an identifier for the specific resource, e.g. for an S3 Bucket the configured bucket name.
  • SequentialID or Random String For a few resources we need to add an optional sequential id or random string to identify them

All resource names that are deployed by Serverless have to follow this naming scheme. The only exception (for backwards compatibility reasons) is the S3 Bucket that is used to upload artifacts so they can be deployed to your function.

We're also using the term normalizedName or similar terms in this guide. This basically just means dropping any characters that aren't allowed in resources names, e.g. special characters.

AWS Resource Name Template Example
S3::Bucket S3Bucket{normalizedBucketName} S3BucketMybucket
IAM::Role IamRoleLambdaExecution IamRoleLambdaExecution
IAM::Policy IamPolicyLambdaExecution IamPolicyLambdaExecution
Lambda::Function {normalizedFunctionName}LambdaFunction HelloLambdaFunction
Lambda::Permission
  • Schedule: {normalizedFunctionName}LambdaPermissionEventsRuleSchedule{index}
  • S3: {normalizedFunctionName}LambdaPermissionS3
  • APIG: {normalizedFunctionName}LambdaPermissionApiGateway
  • SNS: {normalizedFunctionName}LambdaPermission{normalizedTopicName}
  • Schedule: HelloLambdaPermissionEventsRuleSchedule1
  • S3: HelloLambdaPermissionS3
  • APIG: HelloLambdaPermissionApiGateway
  • SNS: HelloLambdaPermissionSometopic
Events::Rule {normalizedFuntionName}EventsRuleSchedule{SequentialID} HelloEventsRuleSchedule1
ApiGateway::RestApi ApiGatewayRestApi ApiGatewayRestApi
ApiGateway::Resource ApiGatewayResource{normalizedPath}
  • ApiGatewayResourceUsers
  • ApiGatewayResourceUsersVar for paths containing a variable
  • ApiGatewayResourceDash if the path is just a -
ApiGateway::Method ApiGatewayResource{normalizedPath}{normalizedMethod} ApiGatewayResourceUsersGet
ApiGateway::Authorizer {normalizedFunctionName}ApiGatewayAuthorizer HelloApiGatewayAuthorizer
ApiGateway::Deployment ApiGatewayDeployment{randomNumber} ApiGatewayDeployment12356789
ApiGateway::ApiKey ApiGatewayApiKey{SequentialID} ApiGatewayApiKey1
SNS::Topic SNSTopic{normalizedTopicName} SNSTopicSometopic