Good morning. Using python, I am trying to run thi...
# general
Good morning. Using python, I am trying to run this commands as user data after EC2 instances run. It seems like the machine cannot recognize the pull and run commands as they are with "{ecr_repository.url}" not its value. my questions are: 1. Can this script be edited so that pull and push can work? 2. I am not sure why the created images always have the tag of 4xxxxxxx-container, how to control or change that to "latest"?
I have managed to answer question 1. Still not able to answer question 2 which is marked by red lines
Are you pushing the :latest tag when you push the images to the registry?
Not exactly, I am creating an image and its tagged by default with: 46186468-container. always the same tag even after executing pulumi up and down multiple times. I dont know the reason or meaning of the number and I can't change it
it might have something to do with auto naming
pulumi ai thinks this will work:
Copy code
# Build and publish the Docker image to the ECR repository
image = awsx.ecr.Image("myapp",
    tags={"latest": None}  # Tag the image as 'latest'
Yeah GPT is limited in this part, there's no parameter called tags.
yeah I'm looking at the docs and I don't see it there
it's not great but you could output the variable of the image
then write a script to read that image in, add the latest tag, and push
I am trying to avoid that so far 😆
or in the EC2 startup script, pull down the image and tag
and tag? how is that?
I'm thinking there might be a way to output the image:tag with pulumi and have it up on pulumi cloud
then the ec2 bootstrap script could pull from it
why are you doing this anyway? lol
you can spin up a docker image lots of places that are probably easier to interact with
I am trying a simple app, creating an image for it and push it to an ECR repo, then using application load balancer with listener and target group by auto scaling attachment, launch configuration, auto scaling, IAM roles, security groups and I have tried to create a cloudwatch dashboard from the code using some metrics but its not doing well so i'll skip it. What I did with the tag is hardcoding so there must be a way to avoid that
the awsx package is opinionated so I would consider using the advantages that gives you ( )
Using ECS is a different and easier approach, but I was trying these as a POC for me to know the limitations and understand the capabilities
Not all the scenarios should use ECS, that's another point
yeah you are going to run into limitations once APIs don't exist to perform tasks
there is an API to spin up an EC2 instance, but after that the AWS API can't do much to it except power it up and delete it
but there are APIs to spin up containers on ECS or a K8 cluster so you're going to have an easier time
I am trying to use nomad, a hard combination but doable, still on it
Hashicorp makes some good stuff, I'm sure you'll be fine
I'm off to bed - best of luck Ali
Thanks Doug, goodnight
I have fixed point "2" through this, didnt think it was possible at first