https://pulumi.com logo
Title
e

enough-mechanic-81927

05/25/2023, 11:22 AM
const vpc = aws.ec2.getVpc({
    id: "your vpc"
})

const vpcId = vpc.then((vpc)=>vpc.id)
console.log(vpcId)

// An ECS cluster to deploy into
const cluster = new aws.ecs.Cluster("cluster", {});

// An ALB to serve the container endpoint to the internet
const loadbalancer = new awsx.lb.ApplicationLoadBalancer("loadbalancer", {});
b

billowy-army-68599

05/25/2023, 12:13 PM
No it’s not a bug. What are you putting for thebID?
e

enough-mechanic-81927

05/25/2023, 12:24 PM
I gave the vpc-id its just not showing u here in the code
b

billowy-army-68599

05/25/2023, 12:25 PM
Do you have the right region set? Are you sure the credentials you’re passing are for that aws account?
h

handsome-article-22867

05/25/2023, 12:39 PM
Yes we have written the aws:region and aws:profile in pulumi.yaml
e

enough-mechanic-81927

05/25/2023, 12:51 PM
we have done pulumi login s3 to our bucket which is in the same aws account
so that makes sure that we are in. perfect account which has the existing vpc
b

billowy-army-68599

05/25/2023, 12:58 PM
Pulumi login s3 is now the same as the provider credentials. This is almost certainly user error I’m afraid
Did you put the profile and region settings in the stack YAML or the main YAML?
More information will help debug
h

handsome-article-22867

05/25/2023, 12:59 PM
in pulumi.yaml
b

billowy-army-68599

05/25/2023, 12:59 PM
Put it in the stack yaml
h

handsome-article-22867

05/25/2023, 1:00 PM
so do i need to create a new file named as -> stack.yaml ?
b

billowy-army-68599

05/25/2023, 1:00 PM
You need to create a stack and then set the config. I’d recommend following the getting started guides
e

enough-mechanic-81927

05/25/2023, 1:00 PM
it gets created by default when u do pulumi stack init stack-name
My profile and region is set in pulumi.ecs-cluster.yaml
b

billowy-army-68599

05/25/2023, 1:06 PM
do the following:
export AWS_PROFILE=<profile in your `Pulumi.ecs-cluster.yaml`
export AWS_REGION=<region in your yaml file>
aws ec2 describe-vpcs --vpc-id=<vpc-id-in-your-code
what does it return?
h

handsome-article-22867

05/25/2023, 1:07 PM
Still gives the same error ! by creating new stack and set the config in its respective yaml file
It reyurns the vpc in json format !
b

billowy-army-68599

05/25/2023, 1:08 PM
what does your stack yaml look like?
h

handsome-article-22867

05/25/2023, 1:10 PM
name: ecs runtime: nodejs description: ecs cluster and ecr repos config: aws😛rofile: <Profile> aws:region: <Region>
i've created a stack name called as dev
above is Pulumi.dev.yaml file
b

billowy-army-68599

05/25/2023, 1:11 PM
you should have two files.
h

handsome-article-22867

05/25/2023, 1:12 PM
Pulumi.yaml looks like this -> name: ecs runtime: nodejs description: ecs cluster and ecr repos
b

billowy-army-68599

05/25/2023, 1:12 PM
anyway, I’m sorry this is a struggle, this is almost certainly user error. I would recommend starting out and following the user guides exactly
l

limited-rainbow-51650

05/25/2023, 2:58 PM
@handsome-article-22867 you said your stack config file
Pulumi.dev.yaml
looks like:
name: ecs
runtime: nodejs
description: ecs cluster and ecr repos
config:
  aws:profile: <Profile>
  aws:region: <Region>
A stack config file usually only has a
config:
section with the keys underneath. No
name
,
runtime
or
description
property. That is in the Pulumi project file (
Pulumi.yaml
). Did you manually copy
Pulumi.yaml
to
Pulumi.dev.yaml
?
h

handsome-article-22867

05/25/2023, 3:21 PM
yes
but on my system I have deleted the copied code and then I tried with command but getting the same error
e

enough-mechanic-81927

05/25/2023, 3:45 PM
@limited-rainbow-51650 Nothing is created manually .. everything is created from cli. Stack yaml file is created with
pulumi stack init stack-name
and it has region and profile only under config as you showed up in the code
config:
  aws:profile: <Profile>
  aws:region: <Region>
This looks like this in our stack.yaml file
@billowy-army-68599 tried this on our vs code terminal and returned the correct vpc
export AWS_PROFILE=<profile in your `Pulumi.ecs-cluster.yaml`
export AWS_REGION=<region in your yaml file>
aws ec2 describe-vpcs --vpc-id=<vpc-id-in-your-code
but not sure when we do pulumi up why its gives the error ec2 vpc not found
FYI - that vpc is not a default one , That vpc is created by aws control tower , and that aws account has only one vpc which is created by tower
so let me know that tooo, that its not an issue