Error on Deploy CloudFormation in VSCode Bash

I have been having isues trying to get past this error on my VSCode.
I will appreciate any help.
Thank you.

I am trying to try my hand on asset tracking project built on AWS.

$ chmod +x deploy_cloudformation.sh && export AWS_REGION=us-east-1 && ./deploy_cloudformation.sh Deploying kinesis data stream template for sample app. ./deploy_cloudformation.sh: line 16: aws: command not found Retrieving TrackingAndGeofencingSampleKinesisDataStreamARN from the created CloudFormation stack. ./deploy_cloudformation.sh: line 28: aws: command not found Error: Failed to retrieve TrackingAndGeofencingSampleKinesisDataStreamARN from CloudFormation stack.

This is the deploy_cloudformation.sh:

`*#!/bin/sh

Configurable variables

TrackerName=”SampleTracker”

SAR application id for kinesis-stream-device-data-to-amazon-location-tracker app

ApplicationId=”arn:aws:serverlessrepo:us-east-1:003883091127:applications/kinesis-stream-device-data-to-amazon-location-tracker”

if [ -z “$AWS_REGION” ]; then
echo “Error: AWS_REGION is not set. You may set the environment variable with this command: ‘export AWS_REGION=us-east-1’.”
exit 1
fi

echo “Deploying kinesis data stream template for sample app.”

aws cloudformation deploy
–template-file src/cfn_template/kinesisResources.yml
–stack-name TrackingAndGeofencingSampleKinesisStack
–region ${AWS_REGION}

echo “Retrieving TrackingAndGeofencingSampleKinesisDataStreamARN from the created CloudFormation stack.”

Retrieve the KinesisDataStreamARN output from the deployed stack

KinesisDataStreamARN=$(aws cloudformation describe-stacks
–stack-name TrackingAndGeofencingSampleKinesisStack
–query “Stacks[0].Outputs[?OutputKey==’TrackingAndGeofencingSampleKinesisDataStreamARN’].OutputValue”
–output text
–region “${AWS_REGION}”)

Check if KinesisDataStreamARN was retrieved successfully

if [ -z "$KinesisDataStreamARN" ]; then echo "Error: Failed to retrieve TrackingAndGeofencingSampleKinesisDataStreamARN from CloudFormation stack." exit 1 fi

`echo “Creating changeset kinesis-stream-device-data-to-location-tracker Serverless Application with kinesis data stream: $KinesisDataStreamARN.”

ChangeSetName=”kinesis-stream-device-data-to-location-tracker-change-set”
SarStackName=”kinesis-stream-device-data-to-location-tracker-app-stack”

ChangeSetId=$(aws serverlessrepo create-cloud-formation-change-set
–application-id “${ApplicationId}”
–capabilities CAPABILITY_IAM
–region “${AWS_REGION}”
–stack-name “$SarStackName”
–change-set-name “$ChangeSetName”
–parameter-overrides Name=”TrackerName”,Value=”${TrackerName}” Name=”EventBridgeEnabled”,Value=”true” Name=”KinesisStreamArn”,Value=”${KinesisDataStreamARN}”
–query ‘ChangeSetId’
–output text)`

Check if ChangeSetId was captured successfully

if [ -z "$ChangeSetId" ]; then echo "Error: Failed to capture ChangeSetId from the create-cloud-formation-change-set output." exit 1 fi

Sleep for 5 seconds to allow the change set to be created.

sleep 5
Changes=$(aws cloudformation describe-change-set –change-set-name “$ChangeSetName” –stack-name “$SarStackName” –query “Changes” –output text)
echo “$Changes”
if [[ -z “$Changes” || “$Changes” = “None” ]]; then
echo “No changes to deploy. Stack serverlessrepo-$SarStackName is up to date.”
else
echo “Executing change set: $ChangeSetId”

Retry logic for executing the change set to avoid calling the execute API too fast.

` max_attempts=5
attempt=1
while [ “$attempt” -le “$max_attempts” ]; do
echo “Attempt $attempt of $max_attempts: Executing change set $ChangeSetId”

execute_output=$(aws cloudformation execute-change-set --change-set-name "$ChangeSetId" --region "$AWS_REGION" 2>&1)
execute_status=$?

if [ "$execute_status" -eq 0 ]; then
  echo "Change set executed successfully: $ChangeSetId. You can go to CloudFormation's console to monitor the deployment progress."
  break
fi

if [ "$attempt" -eq "$max_attempts" ]; then
  echo "Maximum execution attempts reached, failing execution."
  exit 1
fi

((attempt++))
sleep 1

done
fi

sleep 2 # Wait for 2 seconds for the previous stack deployment to finish the tracker creation.
echo “Deploying cloudformation template for sample app using TrackerName: $TrackerName and region: $AWS_REGION.”

aws cloudformation deploy
–template-file src/cfn_template/locationResources.yml
–stack-name TrackingAndGeofencingSample
–parameter-overrides TrackerName=”${TrackerName}”
–region “${AWS_REGION}”
–capabilities CAPABILITY_NAMED_IAM

echo “All deployments complete!”*`

I have tried to copy templates for creating CloudFormation, but i seem not to understand.

If anyone can point me to a youtube video that can help, i will appreciate.

New contributor

Bolaji Bello is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật