This project builds a simple ami from Amazon Linux and installs AWS Greengrass Core V1:
This is built using packer.io. First step is to validate:
$ packer validate template.json
Template validated successfully.
Next is the build:
$ packer build --var 'aws_profile=<YOUR_AWS_PROFILE>' template.json
...
OPTIONS: You can also choose to include these variable overrides
--var 'aws_ami_name=<YOUR_AWS_AMI_NAME>'
--var 'aws_region=<YOUR_AWS_REGION>'
--var 'source_ami_id=<YOUR_AWS_AMI>'
NOTE: This depends on an AWS cli profile being set using aws configure
Once you start and EC/2 instance from this AMI you need to perform some setup steps:
mkdir certs/
echo Core Certificate ARN = $(aws iot create-keys-and-certificate \
--profile <YOUR_AWS_PROFILE> \
--region <YOUR_AWS_REGION> \
--set-as-active \
--certificate-pem-outfile certs/core.cert.pem \
--public-key-outfile certs/core.public.key \
--private-key-outfile certs/core.private.key | jq '.certificateArn' -r)
scp -i <YOUR_PEM>.pem certs/core* ec2-user@<YOUR_PUBLIC_DNS_NAME>:~/
ssh -i <YOUR_PEM>.pem certs/core* ec2-user@<YOUR_PUBLIC_DNS_NAME>
sudo cp ~/core* /greengrass/certs
sudo vi /greengrass/config/config.json
cd /greengrass/ggc/core/
sudo ./greengrassd start
# Tail the server log
sudo tail -f /greengrass/ggc/var/log/system/runtime.log
The logs should show your core successfully connecting
You should see this complete successfully and also see log messages appear in the core logs