I can see some basic support in Sceptre for AWS SAM although there don't appear to be any code examples or blog posts and it's unclear to me how you would actually do SAM in Sceptre, especially after SAM's guided deploy mode became the standard.
In the mean time, can anyone suggest the high level approach- would I create a Python wrapper to call the SAM CLI to do sam build and sam package and then use the output of sam package as the Sceptre template?
Related https://github.com/Sceptre/sceptre/issues/324#issuecomment-482255575
thanks for the info @alexharv074 The way to pass in S3 bucket to your sceptre_handler is to do something like this..
in templates/mytemplate.yaml
template_path: mytemplate.py
stack_name: mystack
sceptre_user_data:
my_bucket: "alexharvey3118"
You should have access to sceptre_user_data.my_bucket in your sceptre_handler() method.
You could, alternatively, provide the same functionality with a sceptre hook. The hook would process the handler and trophosphere code before deploying to AWS.
Another alternative is to just use the SAM CLI to build and deploy process the SAM templates to an S3 bucket then have sceptre take over with deploying the generated SAM template to AWS. This is what we do using our CI, https://github.com/Sage-Bionetworks/aws-infra/blob/master/.travis.yml
I agree that SAM is an important piece of modern AWS infrastructure and that sceptre docs would be enhanced by including SAM guidance.
I stared with a sceptre hook based, but found it ugly to implement both before_create and before_update with cut and paste.
We followed the SAM CLI solution path and:
sceptre launch the required artifact bucket sceptre list outputsam build and sam package writing artifacts to the bucket and outputting a (.gitignore-d) CFN to the template/ foldersceptre launchsI can create a sample repo, or contribute to the docs, if this pattern is of interest.
That would be awesome sounds like a good approach
I've published:
https://github.com/Versent/sam-sceptre
This repo gives a example skeleton for deploying AWS Lambda resources in CloudFormation templates or SAM templates using CloudReach's Sceptre.
Feedback welcome.
if this helps anyone, we too have a github template for creating a sam app and deploying with sceptre. https://github.com/Sage-Bionetworks-IT/lambda-template
It would be cool to include these in the main docs - at least a link to the external examples or even bring these examples into the main docs. What do you think @jghaines & @zaro0508 ?
Seems like a good idea @ngfgrant however i'm not sure what you are expecting. Did you want a PR to update the docs with your suggestions?
If you'd or jghaines would be willing to then it would be an easily accepted PR for sure!
Most helpful comment
I agree that SAM is an important piece of modern AWS infrastructure and that sceptre docs would be enhanced by including SAM guidance.
I stared with a sceptre hook based, but found it ugly to implement both before_create and before_update with cut and paste.
We followed the SAM CLI solution path and:
sceptre launchthe required artifact bucketsceptre list outputsam buildandsam packagewriting artifacts to the bucket and outputting a (.gitignore-d) CFN to the template/ foldersceptre launchsI can create a sample repo, or contribute to the docs, if this pattern is of interest.