{"id":22615605,"url":"https://github.com/marcellodesales/pulumi-infra-aws-python","last_synced_at":"2025-03-29T00:42:34.659Z","repository":{"id":142072954,"uuid":"512391538","full_name":"marcellodesales/pulumi-infra-aws-python","owner":"marcellodesales","description":"Tutorial covering Pulumi aws python sdk","archived":false,"fork":false,"pushed_at":"2022-07-10T09:14:48.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T10:46:22.657Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcellodesales.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-10T09:14:09.000Z","updated_at":"2022-07-10T09:14:50.000Z","dependencies_parsed_at":"2023-07-09T05:31:58.041Z","dependency_job_id":null,"html_url":"https://github.com/marcellodesales/pulumi-infra-aws-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fpulumi-infra-aws-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fpulumi-infra-aws-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fpulumi-infra-aws-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fpulumi-infra-aws-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcellodesales","download_url":"https://codeload.github.com/marcellodesales/pulumi-infra-aws-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246122247,"owners_count":20726822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-08T19:08:29.950Z","updated_at":"2025-03-29T00:42:34.651Z","avatar_url":"https://github.com/marcellodesales.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pulumi Infra\n\n* Creates the infrastructure for the project\n\n\u003e **Ref**: https://www.pulumi.com/docs/get-started/aws\n\n# Setup\n\n* AWS Setup\n* Pulumi Account\n\n## AWS Setup\n\n* Create a new account or use existing\n  * Use the `AWS_PROFILE` approach which is simple\n\n```console\n$ export AWS_PROFILE=marcellodesales-aws\n```\n\n* Make sure you have full connectivity\n\n```console\n$ aws s3 ls --debug\n2022-07-10 00:37:58,280 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.2.21 Python/3.8.8 Darwin/21.5.0 exe/x86_64\n2022-07-10 00:37:58,280 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['s3', 'ls', '--debug']\n...\n...\n```\n\n## Pulumi Setup\n\n* Execute the login\n* Establish the use of the profile above\n\n```console\n$ pulumi new aws-python                                                                                                                         Who called me was -zsh\nManage your Pulumi stacks by logging in.\nRun `pulumi login --help` for alternative login options.\nEnter your access token from https://app.pulumi.com/account/tokens\n    or hit \u003cENTER\u003e to log in using your browser                   :\nWe've launched your web browser to complete the login process.\n\nWaiting for login to complete...\n```\n\n* After the login, you will be able to execute... \n* Make sure to use the profile\n\n```console\npulumi config set aws:profile marcellodesales-aws\n```\n\n* This will change the config at ~/.pulumi\n\n\u003e cdat ~/.pulumi/credentials.json\n\n```json\n{\n    \"current\": \"https://api.pulumi.com\",\n    \"accessTokens\": {\n        \"https://api.pulumi.com\": \"pul-6927912193183d*********8beae1\"\n    },\n    \"accounts\": {\n        \"https://api.pulumi.com\": {\n            \"accessToken\": \"pul-692791288******560f8beae1\",\n            \"username\": \"marcellodesales\",\n            \"organizations\": [\n                \"marcellodesales\"\n            ],\n            \"lastValidatedAt\": \"2022-07-10T00:07:29.084598-07:00\"\n        }\n    }\n}%\n```\n\n# Deploy Infra\n\n* Just run the following:\n\n```console\n$ pulumi up --debug\nPreviewing update (4trade-serverless-infra-aws)\n\nView Live: https://app.pulumi.com/marcellodesales/4trade/4trade-serverless-infra-aws/previews/9f300e52-35e9-4f81-9220-1e7b23eaa232\n\n     Type                 Name                                Plan       Info\n +   pulumi:pulumi:Stack  4trade-4trade-serverless-infra-aws  create     120 debugs\n +   └─ aws:s3:Bucket     my-bucket                           create\n\nDiagnostics:\n  pulumi:pulumi:Stack (4trade-4trade-serverless-infra-aws):\n    debug: registering resource: ty=pulumi:pulumi:Stack, name=4trade-4trade-serverless-infra-aws, custom=False, remote=False\n    debug: registering resource: ty=aws:s3/bucket:Bucket, name=my-bucket, custom=True, remote=False\n    debug: Waiting for outstanding RPCs to complete\n    debug: RPCs successfully completed\n    debug: Waiting for 33 outstanding tasks to complete\n    debug: beginning rpc register resource\n    debug: beginning rpc register resource\n    debug: beginning rpc register resource outputs\n    debug: resource registration prepared: ty=pulumi:pulumi:Stack, name=4trade-4trade-serverless-infra-aws\n    debug: resource registration successful: ty=pulumi:pulumi:Stack, urn=urn:pulumi:4trade-serverless-infra-aws::4trade::pulumi:pulumi:Stack::4trade-4trade-serverless-infra-aws\n```\n\n# Add HTML to Bucket\n\n* Create an html fle\n\n```console\n$ cat \u003c\u003cEOT \u003e index.html\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003ch1\u003eHello, Pulumi!\u003c/h1\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\nEOT \n```\n\nThen, updated the main file with the block for it and the bucket to serve it as html (see commit)\n\n```console\n$ vim __main__.py\n$ pulumi up -y\nPreviewing update (4trade-serverless-infra-aws)\n\nView Live: https://app.pulumi.com/marcellodesales/4trade/4trade-serverless-infra-aws/previews/aea54484-6605-46fc-a226-7018177ab9b8\n\n     Type                    Name                                Plan       Info\n     pulumi:pulumi:Stack     4trade-4trade-serverless-infra-aws\n ~   ├─ aws:s3:Bucket        my-bucket                           update     [diff: +website]\n ~   └─ aws:s3:BucketObject  index.html                          update     [diff: ~acl,contentType]\n\nResources:\n    ~ 2 to update\n    1 unchanged\n\nUpdating (4trade-serverless-infra-aws)\n  1 \"\"\"An AWS Python Pulumi program\"\"\"\n  2\n\nView Live: https://app.pulumi.com/marcellodesales/4trade/4trade-serverless-infra-aws/updates/3\n\n     Type                    Name                                Status      Info\n     pulumi:pulumi:Stack     4trade-4trade-serverless-infra-aws\n ~   ├─ aws:s3:Bucket        my-bucket                           updated     [diff: +website]\n ~   └─ aws:s3:BucketObject  index.html                          updated     [diff: ~acl,contentType]\n\nOutputs:\n    bucket_name: \"my-bucket-72340a9\"\n\nResources:\n    ~ 2 updated\n    1 unchanged\n\nDuration: 4s\n```\n\n* Confirm \n\n```console\n$ pulumi up -y\nPreviewing update (4trade-serverless-infra-aws)\n\nView Live: https://app.pulumi.com/marcellodesales/4trade/4trade-serverless-infra-aws/previews/005b060b-5662-4605-8553-7d8ea06985b7\n\n     Type                 Name                                Plan\n     pulumi:pulumi:Stack  4trade-4trade-serverless-infra-aws\n\nOutputs:\n  + bucket_endpoint: \"http://my-bucket-72340a9.s3-website-us-east-1.amazonaws.com\"\n\nResources:\n    3 unchanged\n\nUpdating (4trade-serverless-infra-aws)\n\nView Live: https://app.pulumi.com/marcellodesales/4trade/4trade-serverless-infra-aws/updates/4\n\n     Type                 Name                                Status\n     pulumi:pulumi:Stack  4trade-4trade-serverless-infra-aws\n\nOutputs:\n  + bucket_endpoint: \"http://my-bucket-72340a9.s3-website-us-east-1.amazonaws.com\"\n    bucket_name    : \"my-bucket-72340a9\"\n\nResources:\n    3 unchanged\n\nDuration: 2s\n```\n\n* Curl the website\n\n```console\n$ pulumi stack output bucket_endpoint\nhttp://my-bucket-72340a9.s3-website-us-east-1.amazonaws.com\n\n$ curl $(pulumi stack output bucket_endpoint)\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003ch1\u003eHello, Pulumi!\u003c/h1\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\n# Destroy all\n\n```console\n$ pulumi destroy\nPreviewing destroy (4trade-serverless-infra-aws)\n\nView Live: https://app.pulumi.com/marcellodesales/4trade/4trade-serverless-infra-aws/previews/6d4b8b9d-592a-49cf-ba67-37c52e88e7ee\n\n     Type                    Name                                Plan\n -   pulumi:pulumi:Stack     4trade-4trade-serverless-infra-aws  delete\n -   ├─ aws:s3:BucketObject  index.html                          delete\n -   └─ aws:s3:Bucket        my-bucket                           delete\n\nOutputs:\n  - bucket_endpoint: \"http://my-bucket-72340a9.s3-website-us-east-1.amazonaws.com\"\n  - bucket_name    : \"my-bucket-72340a9\"\n\nResources:\n    - 3 to delete\n\nDo you want to perform this destroy? yes\nDestroying (4trade-serverless-infra-aws)\n\nView Live: https://app.pulumi.com/marcellodesales/4trade/4trade-serverless-infra-aws/updates/5\n\n     Type                    Name                                Status\n -   pulumi:pulumi:Stack     4trade-4trade-serverless-infra-aws  deleted\n -   ├─ aws:s3:BucketObject  index.html                          deleted\n -   └─ aws:s3:Bucket        my-bucket                           deleted\n\nOutputs:\n  - bucket_endpoint: \"http://my-bucket-72340a9.s3-website-us-east-1.amazonaws.com\"\n  - bucket_name    : \"my-bucket-72340a9\"\n\nResources:\n    - 3 deleted\n\nDuration: 3s\n\nThe resources in the stack have been deleted, but the history and configuration associated with the stack are still maintained.\nIf you want to remove the stack completely, run 'pulumi stack rm 4trade-serverless-infra-aws'.\n```\n\n* Confirm it was deleted\n\n```console\n$ curl $(pulumi stack output bucket_endpoint)\nerror: current stack does not have output property 'bucket_endpoint'\ncurl: try 'curl --help' or 'curl --manual' for more information\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcellodesales%2Fpulumi-infra-aws-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcellodesales%2Fpulumi-infra-aws-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcellodesales%2Fpulumi-infra-aws-python/lists"}