diff --git a/new-api.go b/new-api.go index a37340c..d45347e 100644 --- a/new-api.go +++ b/new-api.go @@ -175,7 +175,7 @@ func (tmpl *TmplData) bootstrapAPI() error { } green := color.New(color.FgGreen).SprintFunc() - fmt.Printf("Success! Created API GW project at %s\nInside that directory, you can run several commands:\n\n\t%s\n\t\tcreates a zip of your code and dependencies and uploads it to S3\n\t%s\n\t\tdeploys the specified CloudFormation/SAM template by creating and then executing a change set\n\nHowever I recommend taking a look at the README file first\n\n", green(tmpl.ApiProjectName+"/"), green("sam package --template-file apigw.yml --output-template-file out.yaml --s3-bucket Your-S3-bucket"), green("sam deploy --template-file ./out.yaml --stack-name your-api-project --capabilities CAPABILITY_IAM")) + fmt.Printf("Success! Created API GW project at %s\nInside that directory, you can run several commands:\n\n\t%s\n\t\tcreates a zip of your code and dependencies and uploads it to S3\n\t%s\n\t\tdeploys the specified CloudFormation/SAM template by creating and then executing a change set\n\nHowever I recommend taking a look at the README file first\n\n", green(tmpl.ApiProjectName+"/"), green("sam package --template-file apigw.yml --output-template-file out.yaml --s3-bucket Your-S3-bucket"), green("aws cloudformation deploy --template-file ./out.yaml --stack-name my-api-stack --capabilities CAPABILITY_IAM")) return nil } diff --git a/tmpl-readme.go b/tmpl-readme.go index f2206e9..3a13532 100644 --- a/tmpl-readme.go +++ b/tmpl-readme.go @@ -25,7 +25,7 @@ $ sam package --template-file apigw.yml --output-template-file out.yaml --s3-bu ### Deploy the API ` + "```" + `bash -$ sam deploy --template-file ./out.yaml --stack-name your-api-project --capabilities CAPABILITY_IAM +$ aws cloudformation deploy --template-file ./out.yaml --stack-name your-api-project --capabilities CAPABILITY_IAM ` + "```" + ` Go to the AWS console > Cloudformation. Make sure the Cloudformations stack finishes. Take a look at the output to get the URL of your newly created API project. Either curl the address at the /hello endpoint or run the endpoint directly in the API Gateway console. diff --git a/tmpl-sam.go b/tmpl-sam.go index 1ede1b2..3e186de 100644 --- a/tmpl-sam.go +++ b/tmpl-sam.go @@ -16,12 +16,14 @@ Parameters: Environment: Description: name of the environment Type: String + Default: test AllowedValues: [test, prod] {{ else }} Parameters: Environment: Description: name of the environment Type: String + Default: test AllowedValues: [test, prod] {{ end}} @@ -149,25 +151,14 @@ Resources: Tracing: Active Policies: - AWSLambdaExecute - Layers: - - !Ref HelloWorldLayer Events: AnyApi: Type: Api Properties: RestApiId: !Ref AWSApi - Path: '/{{ .LambdaFunctionName }}/{userId}' + Path: '/{{ .LambdaFunctionName }}' Method: GET - HelloWorldLayer: - Type: AWS::Serverless::LayerVersion - Properties: - LayerName: recommendations-deps - Description: Dependencies for HelloWorldFunction - ContentUri: src/{{ .LambdaFunctionName }}/dependencies/ - CompatibleRuntimes: - - python3.7 - RetentionPolicy: Retain Outputs: ApiURL: diff --git a/tmpl-swagger.go b/tmpl-swagger.go index 8c76eb3..5338d59 100644 --- a/tmpl-swagger.go +++ b/tmpl-swagger.go @@ -31,7 +31,7 @@ servers: description: Production environment URL paths: - /v1/{{ .LambdaFunctionName }}: + /{{ .LambdaFunctionName }}: get: summary: hello world endpoint description: outputs hello world