https://pulumi.com logo
#general
Title
# general
l

lemon-egg-20955

05/07/2020, 10:40 PM
Hi, I have had quite possibly the worst time using pulumi - anyone able to give me some pointers?
g

gentle-diamond-70147

05/07/2020, 10:41 PM
Yes, happy to help!
l

lemon-egg-20955

05/07/2020, 10:42 PM
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

gentle-diamond-70147

05/07/2020, 10:46 PM
What issue are you hitting while doing that?
l

lemon-egg-20955

05/07/2020, 10:47 PM
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

gentle-diamond-70147

05/07/2020, 11:02 PM
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

lemon-egg-20955

05/07/2020, 11:19 PM
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

gentle-diamond-70147

05/07/2020, 11:47 PM
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

lemon-egg-20955

05/07/2020, 11:48 PM
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

gentle-diamond-70147

05/07/2020, 11:51 PM
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.
4 Views