The docs say they do exactly the same thing:
Both the sam package and sam deploy commands described in this section are identical to their AWS CLI equivalent commands aws cloudformation package and aws cloudformation deploy, respectively.
But my experience suggests that isn't quite true. When I run sam deploy
for my Java-based Lambda gets an artifact uploaded to S3 with this type of zip structure:
- META-INF
- com/example/etc, class files
- logback.groovy, other resources
- lib, which contains all my jars
And this executes nicely in Lambda. But when I follow the Lambda + CodePipeline docs and use aws cloudformation
, I get this zip structure (which is essentially my git repo):
- README.md
- build/
- build.gradle
- buildspec.yml
- events
- gradle/
- gradlew
- gradlew.bat
- src/
- template.yml
Note: this alternative structure happens even outside of CodeBuild, so I am doubtful it has anything to do with what is in buildspec.yml
. I can reproduce the two structures simply by invoking the two different package commands on my desktop.
Any ideas why there is a difference? I'd like to understand it, especially since the docs say they should be the same, before I switch my buildspec.yml
to use sam deploy
.
Thanks!