Hi, I have had quite possibly the worst time using...
# general
l
Hi, I have had quite possibly the worst time using pulumi - anyone able to give me some pointers?
g
Yes, happy to help!
l
I am trying to launch some ECS task definitions using images that already exist in a ECR repository
(this is just my most recent issue)
g
What issue are you hitting while doing that?
l
a) it is not documented how this is achieved
b) every way i've tried thus far has resulted in the container image not being pulled
all documentation I have found states that you can use ECR to build an image from a path
which is fine and fair enough and I use this method already
but what about an ECR image that is already there?
hmm I think I actually solved it
Copy code
{ image: new awsx.ecr.RepositoryImage(repository, repository.repositoryUrl + ':' + image) }
That seems silly to me
but it works
g
I'm not too familiar with ECR, but let me take a look...
I believe you should be able to just pass the literal string of the ECR image URL - e.g.
aws_account_<http://id.dkr.ecr.us-west-2.amazonaws.com/amazonlinux:latest|id.dkr.ecr.us-west-2.amazonaws.com/amazonlinux:latest>
.
l
I see - seems odd
Next thing: How do I specify two listeners forwarding to the same Target Group if I've used the "awsx.lb.ApplicationLoadBalancer" to create my listeners?
for example, one listener on port 80 forwarding to my "api" target group, and 443 with a cert attached to my "api" target group also
g
I believe you can do it like this:
Copy code
const alb = new <http://awsx.lb|awsx.lb>.ApplicationLoadBalancer("net-lb", {
    external: true,
    securityGroups: cluster.securityGroups
});

const http = alb.createListener("http", { port: 80, external: true });
const https = alb.createListener("https", { port: 443, external: true, certificateArn: "your_arn" });
l
this does not work
Copy code
const apiTarget = new awsx.elasticloadbalancingv2.ApplicationTargetGroup('api-target', {
    loadBalancer: alb2,
    port: 80,
    protocol: 'HTTP'
  });

  const api = alb2.createListener("api-http", { port: 80, external: true, targetGroup: apiTarget });
  const apiSsl = alb2.createListener("api-https", { port: 443, external: true, certificateArn: 'arn', targetGroup: apiTarget });
^ that works
g
I see.
In case it's not obvious, you're using our
awsx
package which builds on top of the low-level
aws
resources. It's meant to make some of the AWS resources (like ECS, API Gateway, etc) a bit easier to use, but if you're familiar with the low-level AWS resources it might not feel as natural.