Hey all I'm looking to create a few things on AWS,...
# aws
w
Hey all I'm looking to create a few things on AWS, notably ECR, ECS, and a task. I have all the code setup and it looks like it is running, but it eventually get's stuck in the running state forever. If I cancel execution and run again it doesn't progress as far. I tried running verbose logging but I didn't get anything outputted when I did, though it could be because the execution never fails. Worth noting I'm very new to this just looking to get some simple stuff up. If I do a clean run with new values I can see the repository being created, cluster, but after that it looks like it gets stuck. If I try canceling the
pulumi up
and run it again, it gets stuck earlier this time on
Copy code
pulumi:pulumi:Stack  AstralPlagueECS-dev  running...
     └─ awsx:ecr:Image    lfs-rs-image                     Building image 'D:lfs-rs-mainlfs-rs-main'...
The following is the code I'm using:
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

// Create an ECR repository
const repo = new aws.ecr.Repository("astral-plague-repository");

// Build and publish the Docker image to the ECR repository
const image = new awsx.ecr.Image("lfs-rs-image", {
  repositoryUrl: repo.repositoryUrl,
  path: "D:\lfs-rs-main\lfs-rs-main", // the source of my image
});

// Create an ECS cluster
const cluster = new aws.ecs.Cluster("AstralPlagueLFSCluster");

// Define the task definition with the container configuration
const taskDefinition = new awsx.ecs.FargateTaskDefinition("APLFSRudolfsTask", {
  containers: {
    myContainer: {
      image: image.imageUri, // Use the image from ECR
      cpu: 512,
      memory: 1024,
      essential: true,
      name: "APLFSRudolfsTask", // Add the required 'name' property
      entryPoint: [
        "/tini", "--", "/lfs-rs",
        "--cache-dir", "/data/",
        "--max-cache-size", "4GB",
        "--log-level", "info",
        "--lock-backend", "dynamodb",
        "--lock-dynamodb-table", "my-table",
        "--github-auth",
        "s3", "--bucket", "my-bucket",       
      ],
      
    },
  },
});



// Create a Fargate service to run the task definition
const service = new awsx.ecs.FargateService("astralService", 
{  
  cluster: cluster.arn,
  taskDefinition: taskDefinition.taskDefinition.arn, // Use the ARN of the task definition
  desiredCount: 1,  
  assignPublicIp: true,
  
  // Define other service properties if needed
});


// Export the cluster name, service name, and repository URL
export const clusterName = cluster.name;
export const serviceName = service;
export const repositoryUrl = repo.repositoryUrl;
l
What version of AWSX are you using? I don't see a path property in the args. I see context and dockerfile.
Copy code
const image = new awsx.ecr.Image("lfs-rs-image", {
  repositoryUrl: repo.repositoryUrl,
  path: "D:\lfs-rs-main\lfs-rs-main", // the source of my image
});
https://www.pulumi.com/registry/packages/awsx/api-docs/ecr/image/
Also, check your backslashes. This is typescript, so it treats backslashes differently than PowerShell or cmd does.
w
The dependency versions are -> "dependencies": { "@pulumi/aws": "^6.13.3", "@pulumi/awsx": "^1.0.6", "@pulumi/pulumi": "^3.0.0" I'll check the backslashes, that's a good point
l
AWSX is on 2.10.0 right now. You might want to upgrade. I don't know when the new Docker provider was released, but if 1.0.6 is using the old one and 2.10 is using the new one, you should definitely upgrade.
w
Yup I didn't realize that, got that from the AI, I should've double checked
l
^1.0.6 will take the latest version within 1.0, right? It won't go to 2.10...
Word to the wise: Don't use A"I". In my experience, it's really really not compatible with creating software.
(Sorry Pulumi.)
w
I figured I'd give the pulumi one a try, but it hasn't had much success aside from the basic infrastructure. I try to never touch it when I can . I'll try to change the directory you mentioned and update the version and see what happens
I went through and updated all the dependencies in the package file and re-ran that same code and didn't get anything different. I also swapped the backslashes to comply with typescript's format -- from what I can tell at least.
l
Do you still have a
path
property in your input arg? Is that showing up as an error in your IDE?
w
Nope, I don't have any indication that path is incorrect. I waited a while and it seemed to do something different this time. Now I'm getting errors indicating the repo it tried to push to doesn't exist, so I'll see what that's about