Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AWS source block to Packer config #53

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

EmmanuelNwa247
Copy link
Collaborator

@EmmanuelNwa247 EmmanuelNwa247 commented Mar 1, 2025

This PR Includes

  • Updated the ubuntu.pkr.hcl config file, adding an Amazon source and build block.

  • Included an aws-post-install script for post-installation steps specific to Amazon AMI VM builds.

Testing

Testing Instructions:

  • Ensure your AWS credentials are configured in your local environment.

  • Navigate to Directory: Go to the utils directory.

Build AWS AMI: Run the following command to build the AWS AMI
./build.sh dibbs-ecr-viewer v2.0.0-beta

  • Go to the AMI section in the AWS console and verify the newly built AMI.

  • Use the newly built AMI to launch an EC2 instance.

  • Open the inbound rules of your new instance to allow traffic from anywhere on port 3000.

  • Copy the public IPv4 address of the instance and paste it in your browser at http://<your-instance-ip>:3000.

Copy link
Collaborator

@rin-skylight rin-skylight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start! Thank you for tackling the AWS side of this. I have some concerns, but a little cleanup is likely all that is necessary.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script does fundamentally the same thing as our existing post-install.sh. It seems that the only difference is the addition of the sudo command. Can you elaborate on this? I'd like to keep us from having to maintain multiple versions of essentially the same file, if possible.

Copy link
Collaborator Author

@EmmanuelNwa247 EmmanuelNwa247 Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the review, @rin-skylight Our default post-install.sh fails when building the AWS Ubuntu VM because it does not have root permissions to perform package installations and file modifications. when I run with our default I usually run into this error message, hence the addition of sudo ,

==> iso.amazon-ebs.aws-ami: Provisioning with shell script: scripts/aws-post-install.sh
    iso.amazon-ebs.aws-ami: post-install
    iso.amazon-ebs.aws-ami: Reading package lists...
==> iso.amazon-ebs.aws-ami: E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
==> iso.amazon-ebs.aws-ami: E: Unable to lock directory /var/lib/apt/lists/
==> iso.amazon-ebs.aws-ami: curl: (23) Failure writing output to destination
==> iso.amazon-ebs.aws-ami: chmod: cannot access '/etc/apt/keyrings/docker.asc': No such file or directory
==> iso.amazon-ebs.aws-ami: tee: /etc/apt/sources.list.d/docker.list: Permission denied
==> iso.amazon-ebs.aws-ami: E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
    iso.amazon-ebs.aws-ami: Reading package lists...
==> iso.amazon-ebs.aws-ami: E: Unable to lock directory /var/lib/apt/lists/
==> iso.amazon-ebs.aws-ami: W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
==> iso.amazon-ebs.aws-ami: W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
==> iso.amazon-ebs.aws-ami: E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
==> iso.amazon-ebs.aws-ami: E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants