```const vpc = aws.ec2.getVpc({ id: "your vpc"...
# general
e
Copy code
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
No it’s not a bug. What are you putting for thebID?
e
I gave the vpc-id its just not showing u here in the code
b
Do you have the right region set? Are you sure the credentials you’re passing are for that aws account?
h
Yes we have written the aws:region and aws:profile in pulumi.yaml
e
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
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
in pulumi.yaml
b
Put it in the stack yaml
h
so do i need to create a new file named as -> stack.yaml ?
b
You need to create a stack and then set the config. I’d recommend following the getting started guides
e
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
do the following:
Copy code
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
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
what does your stack yaml look like?
h
name: ecs runtime: nodejs description: ecs cluster and ecr repos config: awsprofile <Profile> awsregion <Region>
i've created a stack name called as dev
above is Pulumi.dev.yaml file
b
you should have two files.
h
Pulumi.yaml looks like this -> name: ecs runtime: nodejs description: ecs cluster and ecr repos
b
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
@handsome-article-22867 you said your stack config file
Pulumi.dev.yaml
looks like:
Copy code
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
yes
but on my system I have deleted the copied code and then I tried with command but getting the same error
e
@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
Copy 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
Copy code
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