简体   繁体   English

如何销毁 aws SAM Local lambda?

[英]How do I destroy a aws SAM Local lambda?

Follow the read for an example it says:按照阅读的示例阅读它说:

# AWS SAM Hello World Example #

A simple AWS SAM template that specifies a single Lambda function.

## Usage ##

To create and deploy the SAM Hello World example, first ensure that you've met the requirements described in the [root README](../../README.md). Then
follow the steps below.

### Test your application locally ###

Use [SAM Local](https://github.com/awslabs/aws-sam-local) to run your Lambda function locally:

    sam local invoke "HelloWorldFunction" -e event.json

### Package artifacts ###

Run the following command, replacing `BUCKET-NAME` with the name of your bucket:

    sam package --template-file template.yaml --s3-bucket BUCKET-NAME --output-template-file packaged-template.yaml

This creates a new template file, packaged-template.yaml, that you will use to deploy your serverless application.

### Deploy to AWS CloudFormation ###

Run the following command, replacing `MY-NEW-STACK` with a name for your CloudFormation stack.

    sam deploy --template-file packaged-template.yaml --stack-name MY-NEW-STACK --capabilities CAPABILITY_IAM

This uploads your template to an S3 bucket and deploys the specified resources using AWS CloudFormation.

Now what is the sam local command to delete the whole stack including s3 bucket and CF stack?现在删除整个堆栈(包括 s3 存储桶和 CF 堆栈)的 sam local 命令是什么?

Edit for 2022: 2022年编辑:

Sam cli now has a delete command can see official docs here . Sam cli 现在有一个delete命令,可以在这里查看官方文档。 Should be able run like this now:现在应该可以这样运行了:

sam delete --stack-name MY-NEW-STACK

Thanks @jesusnoseq for pointer to update 🍻.感谢@jesusnoseq 提供更新的指针🍻。


Legacy 2018 Answer旧版 2018 答案

There is currently no sam command to delete all of these resources.目前没有 sam 命令可以删除所有这些资源。 You would just use the relevant aws cli commands which sam-cli is just a wrapper around anyways.您只需使用相关的 aws cli 命令,无论如何 sam-cli 只是一个包装器。 Example to delete you CFN stack.删除 CFN 堆栈的示例。

aws cloudformation delete-stack --stack-name MY-NEW-STACK

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM