0

I am a new user to AWS

I installed my package with packer and successfully created AMI, and all packages works good.

e2esa-packer.amazon-ebs.my-ami: Name: Django
e2esa-packer.amazon-ebs.my-ami: Version: 3.2.18
e2esa-packer.amazon-ebs.my-ami: Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
e2esa-packer.amazon-ebs.my-ami: Home-page: https://www.djangoproject.com/
e2esa-packer.amazon-ebs.my-ami: Author: Django Software Foundation
e2esa-packer.amazon-ebs.my-ami: Author-email: foundation@djangoproject.com
e2esa-packer.amazon-ebs.my-ami: License: BSD-3-Clause
e2esa-packer.amazon-ebs.my-ami: Location: /home/ec2-user/.local/lib/python3.7/site-packages
e2esa-packer.amazon-ebs.my-ami: Requires: sqlparse, pytz, asgiref
e2esa-packer.amazon-ebs.my-ami: Required-by: djangorestframework

But when I create Instance using AMI, all pip installed package are missing. All yum installed packages are still there, and works good.

I tried <pip3 list>, and find out there are no packages installed by pip. But I did install them on AMI, and this instance is create from AMI

Really Confused

I tried to add PATH variables in my_env.sh files and add operations as AWS tutorial. But I found out PATH is added but all packages are gone. In AMI if I use , I will get django path and information. But in Instance created from AMI, I got no module.

I expect my instance works as same as AMI. here is the way I create my instance from AMI

resource "aws_instance" "web_instance" {
  ami           = "ami-037212529c144dd64"
  instance_type = "t2.micro"
  key_name      = "newKey"

  subnet_id                   = aws_subnet.public_subnets[0].id
  vpc_security_group_ids      = [aws_security_group.application.id]
  associate_public_ip_address = true
  disable_api_termination = true

  root_block_device {
    volume_size = 50
    volume_type = "gp2"
    delete_on_termination = true
  }
}
yhx
  • 1
  • 1
  • 1
    Hi yhx, can you post the output as text instead of an image? It makes it easier to debug. – vvvvv Mar 01 '23 at 13:11
  • Thanks for reminding, I edit my post and add some output. Hope it's more clear now – yhx Mar 01 '23 at 16:12

1 Answers1

0

My case is caused by different user. I use ec2-user to ssh-connect in packer, and login to console as root user. It seems sudo yum install packages on all user environment, and pip installed packages only works on single user.

yhx
  • 1
  • 1