Skip to content

Commit

Permalink
Format SAM Deploy Scripts, Remove Debugging (#98)
Browse files Browse the repository at this point in the history
* Format SAM Deploy Scripts, Remove Debugging

* Wrap quotes around s3:// path
  • Loading branch information
kolanos authored Dec 3, 2021
1 parent 1c498e7 commit 0320998
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 50 deletions.
21 changes: 11 additions & 10 deletions examples/sam/distributedtracing/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/bin/bash

accountId=$1

trustedAccountId=$2

region=$3

echo "Deploying example in region ${region} for NR account ${accountId} with trustedAccountId ${trustedAccountId}"

sam build --use-container #--skip-pull-image
sam build --use-container

bucket="newrelic-example-${region}-${accountId}"

aws s3 mb --region ${region} s3://${bucket}
aws s3 mb --region "${region}" "s3://${bucket}"

sam package --region "${region}" --s3-bucket "${bucket}" --output-template-file packaged.yaml

sam package --region ${region} --s3-bucket=${bucket} --output-template-file packaged.yaml
aws cloudformation deploy --region ${region} \
--template-file packaged.yaml \
--stack-name Newrelic-Dt-Example \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}" "TrustedAccountId=${trustedAccountId}"
sam deploy \
--region "${region}" \
--template-file packaged.yaml \
--stack-name Newrelic-Dt-Example \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}" "TrustedAccountId=${trustedAccountId}"
16 changes: 9 additions & 7 deletions examples/sam/dotnet/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ sam build

bucket="newrelic-example-${region}-${accountId}"

aws s3 mb --region ${region} s3://${bucket}
aws s3 mb --region "${region}" "s3://${bucket}"

sam package --region ${region} --s3-bucket=${bucket} --output-template-file packaged.yaml
aws cloudformation deploy --region ${region} \
--template-file packaged.yaml \
--stack-name NewrelicExampleDotnet \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"
sam package --region "${region}" --s3-bucket "${bucket}" --output-template-file packaged.yaml

sam deploy \
--region "${region}" \
--template-file packaged.yaml \
--stack-name NewrelicExampleDotnet \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"
19 changes: 10 additions & 9 deletions examples/sam/go/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@ echo "region set to ${region}"

# The Go1.x runtime does not support Lambda Extensions. Instead, Go Lambdas should be written
# against the "provided" runtime. The aws-lambda-go SDK provides a build tag that makes this easy.
runtime="provided"

echo "Building stand-alone lambda"
build_tags="-tags lambda.norpc"

# Custom runtimes need a bootstrap executable. See https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html
handler="bootstrap"

env GOARCH=amd64 GOOS=linux go build ${build_tags} -ldflags="-s -w" -o ${handler}
env GOARCH=amd64 GOOS=linux go build "${build_tags}" -ldflags="-s -w" -o ${handler}
zip go-example.zip "${handler}"

bucket="newrelic-example-${region}-${accountId}"
aws s3 mb --region ${region} s3://${bucket}
aws s3 cp go-example.zip s3://${bucket}
aws cloudformation deploy --region ${region} \
--template-file template.yaml \
--stack-name NewrelicExampleGo \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"
aws s3 mb --region "${region}" "s3://${bucket}"
aws s3 cp go-example.zip s3://"${bucket}"

aws cloudformation deploy \
--region "${region}" \
--template-file template.yaml \
--stack-name NewrelicExampleGo \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"
18 changes: 10 additions & 8 deletions examples/sam/java/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/bin/bash

accountId=$1

region=$2

echo "region set to ${region}"

sam build --use-container

bucket="newrelic-example-${region}-${accountId}"

#aws s3 mb --region ${region} s3://${bucket}
aws s3 mb --region "${region}" "s3://${bucket}"

sam package --region "${region}" --s3-bucket "${bucket}" --output-template-file packaged.yaml

sam package --region ${region} --s3-bucket ${bucket} --output-template-file packaged.yaml
sam deploy --region ${region} \
--template-file packaged.yaml \
--stack-name NewrelicExampleJava2 \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"
sam deploy \
--region "${region}" \
--template-file packaged.yaml \
--stack-name NewrelicExampleJava \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"
18 changes: 10 additions & 8 deletions examples/sam/node/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/bin/bash

accountId=$1

region=$2

echo "region set to ${region}"

sam build --use-container

bucket="newrelic-example-${region}-${accountId}"

aws s3 mb --region ${region} s3://${bucket}
aws s3 mb --region "${region}" "s3://${bucket}"

sam package --region "${region}" --s3-bucket "${bucket}" --output-template-file packaged.yaml

sam package --region ${region} --s3-bucket=${bucket} --output-template-file packaged.yaml
aws cloudformation deploy --region ${region} \
--template-file packaged.yaml \
--stack-name NewrelicExampleNode \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"
sam deploy \
--region "${region}" \
--template-file packaged.yaml \
--stack-name NewrelicExampleNode \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"
18 changes: 10 additions & 8 deletions examples/sam/python/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/bin/bash

accountId=$1

region=$2

echo "region set to ${region}"

sam build --use-container

bucket="newrelic-example-${region}-${accountId}"

aws s3 mb --region ${region} s3://${bucket}
aws s3 mb --region "${region}" "s3://${bucket}"

sam package --region "${region}" --s3-bucket "${bucket}" --output-template-file packaged.yaml

sam package --region ${region} --s3-bucket=${bucket} --output-template-file packaged.yaml
aws cloudformation deploy --region ${region} \
--template-file packaged.yaml \
--stack-name NewrelicExamplePython \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"
sam deploy \
--region "${region}" \
--template-file packaged.yaml \
--stack-name NewrelicExamplePython \
--capabilities CAPABILITY_IAM \
--parameter-overrides "NRAccountId=${accountId}"

0 comments on commit 0320998

Please sign in to comment.