Reference deployment key in deployment bucket

I’ve created a AWS CodeBuild project using serverless. I would like to set the source for this project as the serverless deployment zip file in S3. This would easily allow me to deploy buildspec files and deploy scripts and version control them with GitHub.

I know there is a variable to get the deployment bucket, -Ref: ServerlessDeploymentBucket, but I was wondering if there was also a variable for the key to the zip folder for each deploy, or if there was a way I could easily obtain this.

I have noticed in the CloudFormation templates that are created, for the Lambda functions, the aforementioned variable for deployment buckets are used, but there isn’t a variable used for the key:

{ "Code": {"S3Bucket":{"Ref":"ServerlessDeploymentBucket"},"S3Key":"serverless/[service-name]/[stage]/[datetime]/[source].zip"}

Is there any way I can get this value for the key and use it elsewhere in my serverless.yml file?

Thanks!

Hi there,
did you get an answer to this ?

I am facing the same need.

Hamlet